From 177a094e0d10d817a3ee7508fdba1c77f5ca55c3 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 14:40:43 +0800 Subject: Add test_list_projects Add test_list_projects Change-Id: I7aabfd2ed48c82e6993b4416ffadd96a22e464a3 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_fake_identity_view.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vio/vio/tests/test_fake_identity_view.py b/vio/vio/tests/test_fake_identity_view.py index e27a8c4..0bea44d 100644 --- a/vio/vio/tests/test_fake_identity_view.py +++ b/vio/vio/tests/test_fake_identity_view.py @@ -40,6 +40,15 @@ class TestFakeProjects(unittest.TestCase): resp = self.view.get(req, "1234abcd") self.assertEqual(200, resp.status_code) + def test_list_projects(self): + req = mock.Mock() + req.META = { + "HTTP_X_AUTH_TOKEN": Token + } + resp = self.view.get(req) + self.assertEqual(200, resp.status_code) + self.assertEqual(3, len(resp.data['projects'])) + class TestFakeToken(unittest.TestCase): -- cgit 1.2.3-korg From 40aa9b56ed90a11a776d86889e3a565539524b41 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 14:42:11 +0800 Subject: Add test_list_projects_unauth Add test_list_projects_unauth Change-Id: I385a589881ebcdbdb8d90c9c3d55598e745f151c Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_fake_identity_view.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_fake_identity_view.py b/vio/vio/tests/test_fake_identity_view.py index 0bea44d..2dde2d6 100644 --- a/vio/vio/tests/test_fake_identity_view.py +++ b/vio/vio/tests/test_fake_identity_view.py @@ -49,6 +49,14 @@ class TestFakeProjects(unittest.TestCase): self.assertEqual(200, resp.status_code) self.assertEqual(3, len(resp.data['projects'])) + def test_list_projects_unauth(self): + req = mock.Mock() + req.META = { + "HTTP_X_AUTH_TOKEN": "invalid" + } + resp = self.view.get(req) + self.assertEqual(401, resp.status_code) + class TestFakeToken(unittest.TestCase): -- cgit 1.2.3-korg From f7765a56512b5dbad612fd6abee52dd22ada3238 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 14:44:33 +0800 Subject: Add test_list_servers Add test_list_servers Change-Id: Ic263cf5670c5e7d624e4d16b7ef889cacbf8e8a0 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_fake_nova_view.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_fake_nova_view.py b/vio/vio/tests/test_fake_nova_view.py index c1c725d..5e56f0f 100644 --- a/vio/vio/tests/test_fake_nova_view.py +++ b/vio/vio/tests/test_fake_nova_view.py @@ -51,6 +51,14 @@ class TestFakeNovaServer(unittest.TestCase): resp = self.view.delete(req, "abcd", Server) self.assertEqual(204, resp.status_code) + def test_list_servers(self): + req = mock.Mock() + req.META = { + "HTTP_X_AUTH_TOKEN": Token + } + resp = self.view.get(req, "abcd") + self.assertEqual(200, resp.status_code) + class TestFakeNovaHypervisors(unittest.TestCase): -- cgit 1.2.3-korg