summaryrefslogtreecommitdiff
path: root/tests/test_swiftclient.py
diff options
context:
space:
mode:
authorDavid Kranz <david.kranz@qrclab.com>2012-08-28 10:25:42 -0400
committerDavid Kranz <david.kranz@qrclab.com>2012-09-04 12:53:18 -0400
commit4b4fbf0dc0d2e918b88c1e387f462faca7e98ffd (patch)
treee76b4d5f0e2f6cfd279deaf3fb699bfadfd7fa1f /tests/test_swiftclient.py
parentc97a90c847f8811e5eb766dd26ff8373675514ac (diff)
downloadpython-swiftclient-4b4fbf0dc0d2e918b88c1e387f462faca7e98ffd.tar.gz
Allow endpoint type to be specified.
Fixes bug 1037690. Change-Id: I36b3807b2f3234c778316f1e743d27304755aed8
Diffstat (limited to 'tests/test_swiftclient.py')
-rw-r--r--tests/test_swiftclient.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index 29233e0..0584d39 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -175,22 +175,24 @@ class TestGetAuth(MockHttpTest):
self.assertEquals(token, None)
def test_auth_v2(self):
- c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0
+ os_options={'tenant_name': 'asdf'}
+ c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(os_options)
url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
- os_options={'tenant_name': 'asdf'},
+ os_options=os_options,
auth_version="2.0")
self.assertTrue(url.startswith("http"))
self.assertTrue(token)
def test_auth_v2_no_tenant_name(self):
- c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0
+ c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0({})
self.assertRaises(c.ClientException, c.get_auth,
'http://www.tests.com', 'asdf', 'asdf',
os_options={},
auth_version='2.0')
def test_auth_v2_with_tenant_user_in_user(self):
- c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0
+ tenant_option = {'tenant_name': 'foo'}
+ c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(tenant_option)
url, token = c.get_auth('http://www.test.com', 'foo:bar', 'asdf',
os_options={},
auth_version="2.0")
@@ -198,7 +200,8 @@ class TestGetAuth(MockHttpTest):
self.assertTrue(token)
def test_auth_v2_tenant_name_no_os_options(self):
- c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0
+ tenant_option = {'tenant_name': 'asdf'}
+ c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(tenant_option)
url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
tenant_name='asdf',
os_options={},
@@ -206,6 +209,17 @@ class TestGetAuth(MockHttpTest):
self.assertTrue(url.startswith("http"))
self.assertTrue(token)
+ def test_auth_v2_with_os_options(self):
+ os_options={'service_type': 'object-store',
+ 'endpoint_type': 'internalURL',
+ 'tenant_name': 'asdf'}
+ c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(os_options)
+ url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
+ os_options=os_options,
+ auth_version="2.0")
+ self.assertTrue(url.startswith("http"))
+ self.assertTrue(token)
+
class TestGetAccount(MockHttpTest):