def test_profile(self): """ Test the profile by uid search. """ self.save_profile_entity() sleep(0.25) search = SearchProvider() profile = search.search_profile(user_id=1) self.assertIsNotNone(profile) self.assertEquals(profile.last_name, "Blouse")
def test_address_state(self): """ Test the address by name search. """ self.save_address_entity() sleep(0.25) search = SearchProvider() address = search.search_address(state="TX") self.assertIsNotNone(address) self.assertEquals(address.city, "Round Rock")
def test_projects(self): """ Test the searching of multiple matching projects. """ self.save_project_entities() sleep(0.25) search = SearchProvider() project_list = search.search_projects(task="work", user_id=1) self.assertIsNotNone(project_list) for project in project_list: self.assertEquals(project.user_id, 1) self.assertEquals(project.description, "Test project description")
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)