summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-04-12 11:02:01 +0800
committerBin Sun <bins@vmware.com>2018-04-12 11:02:20 +0800
commit81c12c95aee1f97fcfeb3ee5258f77bf6cb18a1f (patch)
tree413ca46077d9dde304664114bc987422d6db431a /vio
parentd2615457d2331bf77767cb753ae735a91b1663c5 (diff)
Add fake create token v2 test
Change-Id: I0153d71c04dbd7c50b852460c8e89bf6dd329e93 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun <bins@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/tests/test_fake_identity_view.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/vio/vio/tests/test_fake_identity_view.py b/vio/vio/tests/test_fake_identity_view.py
index 1f7b395..8f3d23a 100644
--- a/vio/vio/tests/test_fake_identity_view.py
+++ b/vio/vio/tests/test_fake_identity_view.py
@@ -79,3 +79,15 @@ class TestFakeTokenV2(unittest.TestCase):
}
resp = self.view.get(mock.Mock())
self.assertEqual(200, resp.status_code)
+
+ @mock.patch("requests.post")
+ @mock.patch.object(fakeResponse, "keystone_tokenV2")
+ def test_create_token(self, mock_keystone_tokenV2, mock_post):
+ req = mock.Mock()
+ req.get_full_path.return_value = "identity/v2.0/tokens"
+ req.body = json.dumps(
+ {"auth": {"scope": {"project": {"id": "1234abcd"}}}})
+ mock_keystone_tokenV2.return_value = {
+ "token": {"value": Token}}
+ resp = self.view.post(req)
+ self.assertEqual(200, resp.status_code)