def get_auth_mgr(): """ Get a connection to auth DB. """ global thread_local if not hasattr(thread_local, '_auth_mgr'): thread_local._auth_mgr = auth_data.AuthorizationDataManager() thread_local._auth_mgr.connect() return thread_local._auth_mgr
def setUp(self): """ Create the auth DB and connect to the DB for each test """ try: os.unlink(self.db_path) except: pass self.auth_mgr = auth_data.AuthorizationDataManager(self.db_path) self.auth_mgr.connect()
def get_auth_mgr(): """ Get a connection to auth DB. """ global thread_local if not hasattr(thread_local, '_auth_mgr'): try: thread_local._auth_mgr = auth_data.AuthorizationDataManager() thread_local._auth_mgr.connect() except (auth_data.DbConnectionError, auth_data.DbAccessError, auth_data.DbUpgradeError) as err: return str(err), None return None, thread_local._auth_mgr
def setUp(self): """ Create the auth DB and connect to the DB for each test """ self.auth_mgr = auth_data.AuthorizationDataManager(self.db_path) self.auth_mgr.connect() # create vms self.vm1_uuid = str(uuid.uuid4()) self.vm1_name = "vm1_test" self.vm2_uuid = str(uuid.uuid4()) self.vm2_name = "vm2_test" self.vm3_uuid = str(uuid.uuid4()) self.vm3_name = "vm3_test" self.tenant_name = "tenant_" + str(random.randint(0, 65536)) self.tenant_2_name = "tenant_" + str(random.randint(0, 65536))
def connect_auth_db(): """ Get a connection to auth DB. """ global _auth_mgr if not _auth_mgr: _auth_mgr = auth_data.AuthorizationDataManager() _auth_mgr.connect()
def setUp(self): self.auth_mgr = auth_data.AuthorizationDataManager() self.auth_mgr.connect()