From e4b4b6e056040e5f8f7179691f4e7669eb8629aa Mon Sep 17 00:00:00 2001 From: Bin Sun Date: Thu, 12 Apr 2018 11:10:54 +0800 Subject: Add fake get tenant test Change-Id: Ic96d450adbf51fd804f98f9bff786f3e31a88eb6 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun --- vio/vio/tests/test_fake_identity_view.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) -- cgit 1.2.3-korg