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()))
   common.loadTable(self.serverName, "Stage_Modes", "emission/tests/data/modes.json")
Example #2
0
 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()))
   common.loadTable(self.serverName, "Stage_Modes", "emission/tests/data/modes.json")
Example #3
0
  def setUp(self):
    # Make sure we start with a clean slate every time
    self.serverName = 'localhost'
    common.dropAllCollections(edb._get_current_db())

    import shutil
    self.config_path = "conf/clients/testclient.settings.json"
    shutil.copyfile("%s.sample" % self.config_path,
                    self.config_path)

    logging.info("After setup, client count = %d, profile count = %d, uuid count = %d" % 
      (get_client_db().estimated_document_count(), get_profile_db().estimated_document_count(), get_uuid_db().estimated_document_count()))
    common.loadTable(self.serverName, "Stage_Modes", "emission/tests/data/modes.json")
Example #4
0
  def setUp(self):
    # Make sure we start with a clean slate every time
    self.serverName = 'localhost'
    common.dropAllCollections(edb._get_current_db())

    import shutil
    self.config_path = "conf/clients/testclient.settings.json"
    shutil.copyfile("%s.sample" % self.config_path,
                    self.config_path)

    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()))
    common.loadTable(self.serverName, "Stage_Modes", "emission/tests/data/modes.json")
Example #5
0
  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'])
Example #6
0
    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'])
Example #7
0
 def __update(self, newEntry):
   get_client_db().update({'name': self.clientName}, newEntry, upsert = True)
   self.__reload()
Example #8
0
 def __reload(self):
   self.clientJSON = None
   if self.clientName is not None:
     self.clientJSON = get_client_db().find_one({'name': self.clientName})
Example #9
0
 def __update(self, newEntry):
   get_client_db().update({'name': self.clientName}, newEntry, upsert = True)
   self.__reload()
 if user.uuid in estag.TEST_PHONE_IDS:
     logging.debug("Found test phone, skipping reset")
 else:
     new_uuid = uuid.uuid4()
     logging.debug("Mapping %s -> %s" % (new_uuid, user.uuid))
     edb.get_uuid_db().update({"uuid": user.uuid},
                              {"$set": {
                                  "uuid": new_uuid
                              }})
     logging.debug("Resetting alternatives...")
     reset_collection(edb.get_alternatives_db(), user.uuid, new_uuid)
     logging.debug("Resetting analysis...")
     reset_collection(edb.get_analysis_timeseries_db(), user.uuid,
                      new_uuid)
     logging.debug("Resetting client...")
     reset_collection(edb.get_client_db(), user.uuid, new_uuid)
     logging.debug("Resetting client_stats_backup...")
     reset_collection(edb.get_client_stats_db_backup(), user.uuid,
                      new_uuid)
     logging.debug("Resetting server_stats_backup...")
     reset_collection(edb.get_server_stats_db_backup(), user.uuid,
                      new_uuid)
     logging.debug("Resetting result_stats_backup...")
     reset_collection(edb.get_result_stats_db_backup(), user.uuid,
                      new_uuid)
     logging.debug("Resetting edb.get_common_place_db...")
     reset_collection(edb.get_common_place_db(), user.uuid, new_uuid)
     logging.debug("Resetting edb.get_common_trip_db...")
     reset_collection(edb.get_common_trip_db(), user.uuid, new_uuid)
     logging.debug("Resetting edb.get_habitica_db...")
     reset_collection(edb.get_habitica_db(), user.uuid, new_uuid)
Example #11
0
 logging.basicConfig(level=logging.DEBUG)
 for user_dict in edb.get_uuid_db().find():
     user = ad.AttrDict(user_dict)
     if user.uuid in estag.TEST_PHONE_IDS:
         logging.debug("Found test phone, skipping reset")
     else:
         new_uuid = uuid.uuid4()
         logging.debug("Mapping %s -> %s" % (new_uuid, user.uuid))
         edb.get_uuid_db().update({"uuid" : user.uuid},
                                  {"$set": {"uuid" : new_uuid}})
         logging.debug("Resetting alternatives...")
         reset_collection(edb.get_alternatives_db(), user.uuid, new_uuid)
         logging.debug("Resetting analysis...")
         reset_collection(edb.get_analysis_timeseries_db(), user.uuid, new_uuid)
         logging.debug("Resetting client...")
         reset_collection(edb.get_client_db(), user.uuid, new_uuid)
         logging.debug("Resetting client_stats_backup...")
         reset_collection(edb.get_client_stats_db_backup(), user.uuid, new_uuid)
         logging.debug("Resetting server_stats_backup...")
         reset_collection(edb.get_server_stats_db_backup(), user.uuid, new_uuid)
         logging.debug("Resetting result_stats_backup...")
         reset_collection(edb.get_result_stats_db_backup(), user.uuid, new_uuid)
         logging.debug("Resetting edb.get_common_place_db...")
         reset_collection(edb.get_common_place_db(), user.uuid, new_uuid)
         logging.debug("Resetting edb.get_common_trip_db...")
         reset_collection(edb.get_common_trip_db(), user.uuid, new_uuid)
         logging.debug("Resetting edb.get_habitica_db...")
         reset_collection(edb.get_habitica_db(), user.uuid, new_uuid)
         logging.debug("Resetting edb.get_pipeline_state_db...")
         reset_collection(edb.get_pipeline_state_db(), user.uuid, new_uuid)
         logging.debug("Resetting edb.get_profile_db...")