Commit a892ffb6 by Kálmán Viktor

dashboard: mock celery calls in node detail tests

parent 9ca3b984
......@@ -615,6 +615,13 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
node = Node.objects.get(pk=1)
trait, created = Trait.objects.get_or_create(name='testtrait')
node.traits.add(trait)
self.patcher = patch("vm.tasks.vm_tasks.get_queues")
self.mock_check_queue = self.patcher.start()
self.mock_check_queue.return_value = {
'x': [{'name': "devenv.vm.fast"}],
'y': [{'name': "devenv.vm.slow"}],
'z': [{'name': "devenv.net.fast"}],
}
def tearDown(self):
super(NodeDetailTest, self).tearDown()
......@@ -622,6 +629,7 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
self.u2.delete()
self.us.delete()
self.g1.delete()
self.patcher.stop()
def test_404_superuser_node_page(self):
c = Client()
......@@ -629,6 +637,12 @@ class NodeDetailTest(LoginMixin, MockCeleryMixin, TestCase):
response = c.get('/dashboard/node/25555/')
self.assertEqual(response.status_code, 404)
def test_200_superuser_node_page(self):
c = Client()
self.login(c, 'superuser')
response = c.get('/dashboard/node/1/')
self.assertEqual(response.status_code, 200)
def test_302_user_node_page(self):
c = Client()
self.login(c, 'user1')
......
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