diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-05-18 01:53:18 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-05-19 07:16:25 +0000 |
commit | 8d8af3c360b360c982b44ba343a97cf5949c8c20 (patch) | |
tree | 6b34aa85679d88c635404657d8ac03f9247ec687 /snaps/openstack/utils/tests/keystone_utils_tests.py | |
parent | 956acc7da293b931c3e21e64fa0a9011f995c11c (diff) |
Add the function of getting endpoint
Functest is trying to leverage SNAPS-OO library to replace some
utility functions, in which def get_endpoint is called by testcases
onos, odl, multisite and cloudify_ims.
JIRA: SNAPS-78
Change-Id: Icb2778e0337a5d4246762ac3037773b39d5d554d
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'snaps/openstack/utils/tests/keystone_utils_tests.py')
-rw-r--r-- | snaps/openstack/utils/tests/keystone_utils_tests.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/snaps/openstack/utils/tests/keystone_utils_tests.py b/snaps/openstack/utils/tests/keystone_utils_tests.py index c072fd3..7bd7f5a 100644 --- a/snaps/openstack/utils/tests/keystone_utils_tests.py +++ b/snaps/openstack/utils/tests/keystone_utils_tests.py @@ -46,6 +46,32 @@ class KeystoneSmokeTests(OSComponentTestCase): keystone = keystone_utils.keystone_client(OSCreds('user', 'pass', 'url', 'project')) keystone.users.list() + def test_get_endpoint_success(self): + """ + Tests to ensure that proper credentials and proper service type can succeed. + """ + endpoint = keystone_utils.get_endpoint(self.os_creds, + service_type="identity") + self.assertIsNotNone(endpoint) + + def test_get_endpoint_fail_without_proper_service(self): + """ + Tests to ensure that proper credentials and improper service type cannot succeed. + """ + with self.assertRaises(Exception): + keystone_utils.get_endpoint(self.os_creds, service_type="glance") + + def test_get_endpoint_fail_without_proper_credentials(self): + """ + Tests to ensure that improper credentials and proper service type cannot succeed. + """ + from snaps.openstack.os_credentials import OSCreds + + with self.assertRaises(Exception): + keystone_utils.get_endpoint( + OSCreds('user', 'pass', 'url', 'project'), + service_type="image") + class KeystoneUtilsTests(OSComponentTestCase): """ |