tests: add convenient TestVM and TestVMCollection classes

Very simple mockups for other tests.
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-12 00:41:29 +01:00
parent f323fdec53
commit 310d9da381
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -23,6 +23,28 @@ import qubesmgmt
import qubesmgmt.app
class TestVM(object):
def __init__(self, name, **kwargs):
self.name = name
for key, value in kwargs.items():
setattr(self, key, value)
def get_power_state(self):
return getattr(self, 'power_state', 'Running')
def __str__(self):
return self.name
def __lt__(self, other):
if isinstance(other, TestVM):
return self.name < other.name
return NotImplemented
class TestVMCollection(dict):
def __iter__(self):
return iter(self.values())
class QubesTest(qubesmgmt.app.QubesBase):
expected_calls = None
actual_calls = None