Fix get_keystone_session

Change-Id: Id5248b91d49485c348b1bf5556d2afce4d003336
changes/02/644902/3
Federico Ressi 4 years ago
parent 323239dd3e
commit eae2951725

@ -94,4 +94,5 @@ def get_keystone_session(credentials=None, shared=True, init_session=None,
manager = manager or SESSIONS
session = manager.get_session(credentials=credentials, shared=shared,
init_session=init_session)
return tobiko.setup_fixture(session).session
session.setUp()
return session.session

@ -164,3 +164,26 @@ class KeystoneSessionManagerTest(CheckSessionCredentialsMixin,
init_session=init_session)
self.assertIs(mock_session, session)
init_session.assert_called_once_with(credentials=CREDENTIALS)
class GetKeystomeSessionTest(base.OpenstackTest):
def test_get_keystone_session(self, credentials=None, shared=True):
session1 = keystone.get_keystone_session(credentials=credentials,
shared=shared)
session2 = keystone.get_keystone_session(credentials=credentials,
shared=shared)
if shared:
self.assertIs(session1, session2)
self.assertIsNotNone(session1)
else:
self.assertIsNot(session1, session2)
self.assertIsNotNone(session1)
self.assertIsNotNone(session2)
def test_get_keystone_session_with_not_shared(self):
self.test_get_keystone_session(shared=False)
def test_get_keystone_session_with_credentials(self):
credentials = keystone.default_keystone_credentials()
self.test_get_keystone_session(credentials=credentials)

Loading…
Cancel
Save