summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-08-29 02:15:28 +0000
committerGerrit Code Review <review@openstack.org>2017-08-29 02:15:28 +0000
commitc50823ebf1fc3d691e1589321fb03a6464604530 (patch)
tree30347b876eaecab3e5a37159d737843bc570aa7e /tests
parentf323bb4824d98e74fdd5e357526ce678d0f7d45a (diff)
parent2ff3102cf779a507af8fa39296154a17a60f540a (diff)
downloadpython-swiftclient-c50823ebf1fc3d691e1589321fb03a6464604530.tar.gz
Merge "Add support for versionless endpoints"
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_swiftclient.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py
index 5384ac7..3de5f02 100644
--- a/tests/unit/test_swiftclient.py
+++ b/tests/unit/test_swiftclient.py
@@ -575,6 +575,26 @@ class TestGetAuth(MockHttpTest):
self.assertTrue(url.startswith("http"))
self.assertTrue(token)
+ def test_get_auth_keystone_versionless(self):
+ fake_ks = FakeKeystone(endpoint='http://some_url', token='secret')
+
+ with mock.patch('swiftclient.client._import_keystone_client',
+ _make_fake_import_keystone_client(fake_ks)):
+ c.get_auth_keystone('http://authurl', 'user', 'key', {})
+ self.assertEqual(1, len(fake_ks.calls))
+ self.assertEqual('http://authurl/v3', fake_ks.calls[0].get('auth_url'))
+
+ def test_get_auth_keystone_versionless_auth_version_set(self):
+ fake_ks = FakeKeystone(endpoint='http://some_url', token='secret')
+
+ with mock.patch('swiftclient.client._import_keystone_client',
+ _make_fake_import_keystone_client(fake_ks)):
+ c.get_auth_keystone('http://auth_url', 'user', 'key',
+ {}, auth_version='2.0')
+ self.assertEqual(1, len(fake_ks.calls))
+ self.assertEqual('http://auth_url/v2.0',
+ fake_ks.calls[0].get('auth_url'))
+
def test_auth_with_session(self):
mock_session = mock.MagicMock()
mock_session.get_endpoint.return_value = 'http://storagehost/v1/acct'