Beispiel #1
0
 def save_address_entity(self):
     """ Save an address entity. """
     address = AddressEntity()
     address.name = "Main"
     address.city = "Round Rock"
     address.state = "TX"
     self.assertTrue(address.save())
Beispiel #2
0
 def test_generic_search(self):
     """ Test the generic search entity. """
     self.save_project_entities()
     self.save_address_entity()
     self.save_profile_entity()
     sleep(0.25)
     search = SearchProvider()
     address = search.search_entity(AddressEntity.get_index(), state="TX")
     self.assertIsNotNone(address)
     self.assertEquals(address.city, "Round Rock")
     profile = search.search_entity(ProfileEntity.get_index(), user_id=1)
     self.assertIsNotNone(profile)
     self.assertEquals(profile.last_name, "Blouse")
     project = search.search_entity(ProjectEntity.get_index(), task="work")
     self.assertIsNotNone(project)
     self.assertTrue("Test project description" in project.description)
     project_list = search.search_entities(ProjectEntity.get_index(), user_id=1, task="work")
     for project in project_list:
         self.assertEquals(project.user_id, 1)
         self.assertEquals(project.description, "Test project description")
     project_list = search.search_entities(ProjectEntity.get_index(), 0, 1, user_id=1, task="work")
     self.assertEquals(len(project_list), 1)
 def search_address(self, **search_criteria):
     """ Get the address based on criteria. """
     return self._get_entity_by_search(Address.get_index(),
                                       **search_criteria)