Пример #1
0
 def testAccurateData(self):
     '''
     Testing the data is built properly.
     '''
     db = get_clients_db()
     print db
     for idx, doc in enumerate(db):
         self.assertEqual(doc, "client_" + str(idx))
Пример #2
0
    def testBaseModel(self):
        '''
        Testing the Static Methods in Base Function
        '''
        db = get_clients_db()
        for i in range(10):
            doc = base_model.BaseModel.get_doc(db, i, "client")
            if i <= 4:
                self. assertEqual(doc.get("name"), "name_" + str(i))
            else:
                self.assertEqual(doc, None)

        for i in range(10):
            doc = base_model.BaseModel.get_doc(db, i, "test")
            self.assertEqual(doc, None)
Пример #3
0
    def testBaseModel(self):
        '''
        Testing the Static Methods in Base Function
        '''
        db = get_clients_db()
        for i in range(10):
            doc = base_model.BaseModel.get_doc(db, i, "client")
            if i <= 4:
                self.assertEqual(doc.get("name"), "name_" + str(i))
            else:
                self.assertEqual(doc, None)

        for i in range(10):
            doc = base_model.BaseModel.get_doc(db, i, "test")
            self.assertEqual(doc, None)
Пример #4
0
class ClientModel(base_model.BaseModel):
    type_name = "client"
    db = connections.get_clients_db()

    def __init__(self, class_id):
        '''
        The init accepts the class_id and then checks to see if the document exists
        Else the init will assign the name as None
        '''
        doc = self.get_doc(self.db, class_id, self.type_name)
        if doc:
            self.name = doc.get("name")
            self._id = doc.get("_id")
            self.exists = True

        else:
            self.name = None
            self.exists = False
Пример #5
0
 def setUpClass(cls):
     if not app.config['CLIENT_DB'].startswith("test"):
         print "YIKES THESE ARE NOT TEST DATABASES! EXITING!"
         exit()
     utils_unittest.setup_database(db_name=app.config['CLIENT_DB'])
     utils_unittest.load_generic_client__data(get_clients_db())
Пример #6
0
 def setUpClass(cls):
     if not app.config['CLIENT_DB'].startswith("test"):
         print "YIKES THESE ARE NOT TEST DATABASES! EXITING!"
         exit()
     utils_unittest.setup_database(db_name=app.config['CLIENT_DB'])
     utils_unittest.load_generic_client__data(get_clients_db())