diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-07-28 14:41:25 -0600 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-07-31 13:36:54 -0600 |
commit | ce19be8891ef3f3e24800924a40f4480dec24bec (patch) | |
tree | 99d04d5ebc261ca1c798a0ba742a687c9375aebe /snaps/openstack/tests/conf/os_credentials_tests.py | |
parent | c4eba6eaaa2f8e0a0ca40c40907fc9e04a65e6d9 (diff) |
Reformat auth_url based on the ID API version.
No longer raising an OSCredsError when the auth_url does
not end with a 'v' + some number. Additionally, the auth_url
will be massaged to remove any 'v' + num from the end of
the URL and generate its own version value based on the ID
API version configured.
JIRA: SNAPS-144
Change-Id: I3a7844025324105576da59b1516d0f541281e6bf
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/tests/conf/os_credentials_tests.py')
-rw-r--r-- | snaps/openstack/tests/conf/os_credentials_tests.py | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/snaps/openstack/tests/conf/os_credentials_tests.py b/snaps/openstack/tests/conf/os_credentials_tests.py index 9c6fcdc..578fa93 100644 --- a/snaps/openstack/tests/conf/os_credentials_tests.py +++ b/snaps/openstack/tests/conf/os_credentials_tests.py @@ -135,23 +135,13 @@ class OSCredsUnitTests(unittest.TestCase): with self.assertRaises(OSCredsError): OSCreds(**{'project_name': 'foo'}) - def test_invalid_auth_url(self): - with self.assertRaises(OSCredsError): - OSCreds(username='foo', password='bar', - auth_url='http://foo.bar', project_name='hello') - - def test_invalid_auth_url_kwargs(self): - with self.assertRaises(OSCredsError): - OSCreds(**{'username': 'foo', 'password': 'bar', - 'auth_url': 'http://foo.bar', 'project_name': 'hello'}) - def test_minimal(self): os_creds = OSCreds( username='foo', password='bar', auth_url='http://foo.bar:5000/v2', project_name='hello') self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) @@ -172,7 +162,7 @@ class OSCredsUnitTests(unittest.TestCase): 'project_name': 'hello'}) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) @@ -196,7 +186,7 @@ class OSCredsUnitTests(unittest.TestCase): 'cacert': 'true', 'region_name': 'test_region'}) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v5', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(5, os_creds.identity_api_version) self.assertEqual(6, os_creds.image_api_version) @@ -220,7 +210,7 @@ class OSCredsUnitTests(unittest.TestCase): 'cacert': True, 'region_name': 'test_region'}) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v5', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(5, os_creds.identity_api_version) self.assertEqual(6, os_creds.image_api_version) @@ -238,11 +228,11 @@ class OSCredsUnitTests(unittest.TestCase): def test_proxy_settings_obj(self): proxy_settings = ProxySettings(host='foo', port=1234) os_creds = OSCreds( - username='foo', password='bar', auth_url='http://foo.bar:5000/v2', + username='foo', password='bar', auth_url='http://foo.bar:5000/', project_name='hello', proxy_settings=proxy_settings) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) @@ -270,7 +260,7 @@ class OSCredsUnitTests(unittest.TestCase): 'project_domain_name': 'domain4'}) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) @@ -295,7 +285,7 @@ class OSCredsUnitTests(unittest.TestCase): project_domain_id='domain3', project_domain_name='domain4') self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) @@ -319,7 +309,7 @@ class OSCredsUnitTests(unittest.TestCase): 'region_name': 'test_region'}) self.assertEqual('foo', os_creds.username) self.assertEqual('bar', os_creds.password) - self.assertEqual('http://foo.bar:5000/v2', os_creds.auth_url) + self.assertEqual('http://foo.bar:5000/v2.0', os_creds.auth_url) self.assertEqual('hello', os_creds.project_name) self.assertEqual(2, os_creds.identity_api_version) self.assertEqual(2, os_creds.image_api_version) |