def setUp(self): from get_database import get_profile_db, get_uuid_db, get_client_db, get_pending_signup_db # Make sure we start with a clean slate every time get_client_db().remove() get_profile_db().remove() get_pending_signup_db().remove() get_uuid_db().remove()
def setUp(self): # Make sure we start with a clean slate every time self.serverName = 'localhost' common.dropAllCollections(get_db()) logging.info("After setup, client count = %d, profile count = %d, uuid count = %d" % (get_client_db().find().count(), get_profile_db().count(), get_uuid_db().count())) load_database_json.loadTable(self.serverName, "Stage_Modes", "tests/data/modes.json")
def __reload(self): self.clientJSON = None if self.clientName is not None: self.clientJSON = get_client_db().find_one({'name': self.clientName}) # clientJSON can be None if we are creating an entry for the first time if self.clientJSON is None: # Avoid Attribute error while trying to determine whether the client is active self.startDatetime = None self.endDatetime = None else: # Do eagerly or lazily? Can also do super lazily and have self.startDatetime = dateutil.parser.parse(self.clientJSON['start_date']) self.endDatetime = dateutil.parser.parse(self.clientJSON['end_date'])
def __reload(self): self.clientJSON = None if self.clientName is not None: self.clientJSON = get_client_db().find_one( {'name': self.clientName}) # clientJSON can be None if we are creating an entry for the first time if self.clientJSON is None: # Avoid Attribute error while trying to determine whether the client is active self.startDatetime = None self.endDatetime = None else: # Do eagerly or lazily? Can also do super lazily and have self.startDatetime = dateutil.parser.parse( self.clientJSON['start_date']) self.endDatetime = dateutil.parser.parse( self.clientJSON['end_date'])
def __update(self, newEntry): get_client_db().update({'name': self.clientName}, newEntry, upsert=True) self.__reload()
def __update(self, newEntry): get_client_db().update({'name': self.clientName}, newEntry, upsert = True) self.__reload()