summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Ke <lokyse@163.com>2018-07-04 03:07:28 +0000
committerGerrit Code Review <gerrit@onap.org>2018-07-04 03:07:28 +0000
commit9a503f6d0c341df9f595a44fbcdd0715cc8338cd (patch)
tree46f0417b43f529b20a6ccbc34e7526b75b012a7e
parent9ba77bfeb879ca376bc409b7cefdaeef27b2344e (diff)
parentf7765a56512b5dbad612fd6abee52dd22ada3238 (diff)
Merge changes from topic 'ut3'
* changes: Add test_list_servers Add test_list_projects_unauth Add test_list_projects
-rw-r--r--vio/vio/tests/test_fake_identity_view.py17
-rw-r--r--vio/vio/tests/test_fake_nova_view.py8
2 files changed, 25 insertions, 0 deletions
diff --git a/vio/vio/tests/test_fake_identity_view.py b/vio/vio/tests/test_fake_identity_view.py
index e27a8c4..2dde2d6 100644
--- a/vio/vio/tests/test_fake_identity_view.py
+++ b/vio/vio/tests/test_fake_identity_view.py
@@ -40,6 +40,23 @@ 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']))
+
+ 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):
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):