Merge "Handle invalidate in identity plugins correctly"
This commit is contained in:
@@ -134,9 +134,12 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
invalidate. This means that it makes sense to try again.
|
invalidate. This means that it makes sense to try again.
|
||||||
If nothing happens returns False to indicate give up.
|
If nothing happens returns False to indicate give up.
|
||||||
"""
|
"""
|
||||||
|
if self.auth_ref:
|
||||||
self.auth_ref = None
|
self.auth_ref = None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def get_endpoint(self, session, service_type=None, interface=None,
|
def get_endpoint(self, session, service_type=None, interface=None,
|
||||||
region_name=None, service_name=None, version=None,
|
region_name=None, service_name=None, version=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
@@ -209,6 +209,18 @@ class CommonIdentityTests(object):
|
|||||||
s = session.Session(auth=a)
|
s = session.Session(auth=a)
|
||||||
self.assertIs(expired_auth_ref, a.get_access(s))
|
self.assertIs(expired_auth_ref, a.get_access(s))
|
||||||
|
|
||||||
|
def test_invalidate(self):
|
||||||
|
a = self.create_auth_plugin()
|
||||||
|
s = session.Session(auth=a)
|
||||||
|
|
||||||
|
# trigger token fetching
|
||||||
|
s.get_token()
|
||||||
|
|
||||||
|
self.assertTrue(a.auth_ref)
|
||||||
|
self.assertTrue(a.invalidate())
|
||||||
|
self.assertIsNone(a.auth_ref)
|
||||||
|
self.assertFalse(a.invalidate())
|
||||||
|
|
||||||
|
|
||||||
class V3(CommonIdentityTests, utils.TestCase):
|
class V3(CommonIdentityTests, utils.TestCase):
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user