def mongo_client(self): if not self.client_mongo: self.client_mongo = get_mongo_client(self.mongo_url) return self.client_mongo
def mongo_client(self): if not self.client_mongo: self.client_mongo = get_mongo_client(self.mongo_url.strip('"')) return self.client_mongo
def init_mongo_client(self): if 'USE_MONGO_SERVER' in os.environ: self.mongo_client = get_mongo_client() self.addCleanup(self.mongo_client.close) else: self.mongo_client = mongomock.MongoClient(connect=False)