summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-04-12 11:10:54 +0800
committerBin Sun <bins@vmware.com>2018-04-12 11:11:13 +0800
commite4b4b6e056040e5f8f7179691f4e7669eb8629aa (patch)
tree914064a40a359f9ced0a6a4700833774ad3b9b34
parent81c12c95aee1f97fcfeb3ee5258f77bf6cb18a1f (diff)
Add fake get tenant test
Change-Id: Ic96d450adbf51fd804f98f9bff786f3e31a88eb6 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun <bins@vmware.com>
-rw-r--r--vio/vio/tests/test_fake_identity_view.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/vio/vio/tests/test_fake_identity_view.py b/vio/vio/tests/test_fake_identity_view.py
index 8f3d23a..e27a8c4 100644
--- a/vio/vio/tests/test_fake_identity_view.py
+++ b/vio/vio/tests/test_fake_identity_view.py
@@ -82,7 +82,7 @@ class TestFakeTokenV2(unittest.TestCase):
@mock.patch("requests.post")
@mock.patch.object(fakeResponse, "keystone_tokenV2")
- def test_create_token(self, mock_keystone_tokenV2, mock_post):
+ def test_create_tokenV2(self, mock_keystone_tokenV2, mock_post):
req = mock.Mock()
req.get_full_path.return_value = "identity/v2.0/tokens"
req.body = json.dumps(
@@ -91,3 +91,17 @@ class TestFakeTokenV2(unittest.TestCase):
"token": {"value": Token}}
resp = self.view.post(req)
self.assertEqual(200, resp.status_code)
+
+
+class TestFakeTenants(unittest.TestCase):
+
+ def setUp(self):
+ self.view = views.FakeTenants()
+
+ @mock.patch.object(fakeResponse, "get_tenants")
+ def test_get_tanent(self, mock_get_tenants):
+ mock_get_tenants.return_value = {
+ "tenant": "1234abbcd"
+ }
+ resp = self.view.get(mock.Mock())
+ self.assertEqual(200, resp.status_code)