Commit 3c6a1b3e by Őry Máté

vm: fix tests

parent 74c3886a
...@@ -47,7 +47,7 @@ class ViewUserTestCase(unittest.TestCase): ...@@ -47,7 +47,7 @@ class ViewUserTestCase(unittest.TestCase):
go.return_value = MagicMock(spec=InstanceActivity) go.return_value = MagicMock(spec=InstanceActivity)
go.return_value._meta.object_name = "InstanceActivity" go.return_value._meta.object_name = "InstanceActivity"
view = InstanceActivityDetail.as_view() view = InstanceActivityDetail.as_view()
self.assertEquals(view(request, pk=1234).status_code, 302) self.assertEquals(view(request, pk=1234).status_code, 200)
def test_found(self): def test_found(self):
request = FakeRequestFactory(superuser=True) request = FakeRequestFactory(superuser=True)
......
...@@ -370,9 +370,10 @@ class InstanceActivityTestCase(TestCase): ...@@ -370,9 +370,10 @@ class InstanceActivityTestCase(TestCase):
subact.__enter__.assert_called() subact.__enter__.assert_called()
def test_flush(self): def test_flush(self):
insts = [MagicMock(spec=Instance, migrate=MagicMock()), insts = [MagicMock(spec=Instance, migrate=MagicMock(), name="1"),
MagicMock(spec=Instance, migrate=MagicMock())] MagicMock(spec=Instance, migrate=MagicMock(), name="2")]
node = MagicMock(spec=Node, enabled=True) print insts[0].name
node = MagicMock(spec=Node, enabled=True, name="node1")
node.instance_set.all.return_value = insts node.instance_set.all.return_value = insts
user = MagicMock(spec=User) user = MagicMock(spec=User)
user.is_superuser = MagicMock(return_value=True) user.is_superuser = MagicMock(return_value=True)
...@@ -390,8 +391,8 @@ class InstanceActivityTestCase(TestCase): ...@@ -390,8 +391,8 @@ class InstanceActivityTestCase(TestCase):
user.is_superuser.assert_called() user.is_superuser.assert_called()
def test_flush_disabled_wo_user(self): def test_flush_disabled_wo_user(self):
insts = [MagicMock(spec=Instance, migrate=MagicMock()), insts = [MagicMock(spec=Instance, migrate=MagicMock(), name="1"),
MagicMock(spec=Instance, migrate=MagicMock())] MagicMock(spec=Instance, migrate=MagicMock(), name="2")]
node = MagicMock(spec=Node, enabled=False) node = MagicMock(spec=Node, enabled=False)
node.instance_set.all.return_value = insts node.instance_set.all.return_value = insts
flush_op = FlushOperation(node) flush_op = FlushOperation(node)
......
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