Raise ClientException for invalid auth version.
Fixes LP Bug #1008667. Change-Id: I1e767a804b617eff8a9700c3d98b2360c040933a
This commit is contained in:
parent
783f16035a
commit
f48f253f4c
1
AUTHORS
1
AUTHORS
@ -55,6 +55,7 @@ Russ Nelson (russ@crynwr.com)
|
||||
Maru Newby (mnewby@internap.com)
|
||||
Colin Nicholson (colin.nicholson@iomart.com)
|
||||
Eamonn O'Toole (eamonn.otoole@hp.com)
|
||||
Dan Prince (dprince@redhat.com)
|
||||
Felipe Reyes (freyes@tty.cl)
|
||||
Victor Rodionov (vito.ordaz@gmail.com)
|
||||
Brent Roskos (broskos@internap.com)
|
||||
|
@ -241,6 +241,9 @@ def get_auth(url, user, key, snet=False, tenant_name=None, auth_version="1.0"):
|
||||
if not tenant_name:
|
||||
raise ClientException('No tenant specified')
|
||||
return _get_auth_v2_0(url, user, tenant_name, key, snet)
|
||||
else:
|
||||
raise ClientException('Unknown auth_version %s specified.' %
|
||||
auth_version)
|
||||
|
||||
|
||||
def get_account(url, token, marker=None, limit=None, prefix=None,
|
||||
|
@ -161,6 +161,12 @@ class TestGetAuth(MockHttpTest):
|
||||
self.assertEquals(url, None)
|
||||
self.assertEquals(token, None)
|
||||
|
||||
def test_invalid_auth(self):
|
||||
c.http_connection = self.fake_http_connection(200)
|
||||
self.assertRaises(c.ClientException, c.get_auth,
|
||||
'http://www.tests.com', 'asdf', 'asdf',
|
||||
auth_version="foo")
|
||||
|
||||
def test_auth_v1(self):
|
||||
c.http_connection = self.fake_http_connection(200)
|
||||
url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
|
||||
|
Loading…
Reference in New Issue
Block a user