Commit 50a6f530 by Őry Máté

vm: fix tests

they didn't even run
parent 69057f65
...@@ -36,17 +36,18 @@ class InstanceTestCase(TestCase): ...@@ -36,17 +36,18 @@ class InstanceTestCase(TestCase):
inst = Mock(state='RUNNING') inst = Mock(state='RUNNING')
assert Instance.is_running.getter(inst) assert Instance.is_running.getter(inst)
def deploy_destroyed(self): def test_deploy_destroyed(self):
inst = Mock(destroyed_at=datetime.now()) inst = Mock(destroyed_at=datetime.now(), spec=Instance,
InstanceDestroyedError=Instance.InstanceDestroyedError)
with self.assertRaises(Instance.InstanceDestroyedError): with self.assertRaises(Instance.InstanceDestroyedError):
Instance.deploy(inst) Instance.deploy(inst)
def destroy_destroyed(self): def test_destroy_destroyed(self):
inst = Mock(destroyed_at=datetime.now()) inst = Mock(destroyed_at=datetime.now(), spec=Instance)
Instance.destroy(inst) Instance.destroy(inst)
self.assertFalse(inst.save.called) self.assertFalse(inst.save.called)
def destroy_sets_destroyed(self): def test_destroy_sets_destroyed(self):
inst = MagicMock(destroyed_at=None, spec=Instance) inst = MagicMock(destroyed_at=None, spec=Instance)
inst.node = MagicMock(spec=Node) inst.node = MagicMock(spec=Node)
inst.disks.all.return_value = [] inst.disks.all.return_value = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment