Merge "Fix the v2 auth plugin to handle empty token"

This commit is contained in:
Jenkins
2014-10-16 16:56:06 +00:00
committed by Gerrit Code Review
2 changed files with 14 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ class Auth(base.BaseIdentityPlugin):
self.user_id = user_id
self.user_name = user_name
self.password = password
self.token = token
self.token = token or None
self.trust_id = trust_id
self.tenant_id = project_id
self.tenant_name = project_name

View File

@@ -46,6 +46,19 @@ class TestV2Auth(testtools.TestCase):
self.assertEqual(expected, sot.get_auth_data(headers))
self.assertEqual({}, headers)
def test_empty_token(self):
kargs = {
'password': common.TEST_PASS,
'token': '',
'user_name': common.TEST_USER,
}
sot = v2.Auth(TEST_URL, **kargs)
self.assertEqual(common.TEST_USER, sot.user_name)
self.assertEqual(common.TEST_PASS, sot.password)
self.assertEqual(None, sot.token)
def test_token(self):
kargs = {
'project_id': common.TEST_TENANT_ID,