def test_searchable_list_get(self): rm = RequestMaker("/api/v1", "fakehost", "faketoken") fake1 = Fake(rm, id=1, param1="one", param2="a") fake2 = Fake(rm, id=1, param1="one", param2="b") fake3 = Fake(rm, id=1, param1="two", param2="c") searchable_list = SearchableList() searchable_list.append(fake1) searchable_list.append(fake2) searchable_list.append(fake3) self.assertTrue(searchable_list.get(param1="one")) self.assertFalse(searchable_list.get(param1="notexists"), 0) self.assertTrue(searchable_list.get(param1="one", param2="a"), 1) self.assertTrue(searchable_list.get())
def test_searchable_list_get(self): rm = RequestMaker('/api/v1', 'fakehost', 'faketoken') fake1 = Fake(rm, id=1, param1='one', param2='a') fake2 = Fake(rm, id=1, param1='one', param2='b') fake3 = Fake(rm, id=1, param1='two', param2='c') searchable_list = SearchableList() searchable_list.append(fake1) searchable_list.append(fake2) searchable_list.append(fake3) self.assertTrue(searchable_list.get(param1='one')) self.assertFalse(searchable_list.get(param1='notexists'), 0) self.assertTrue(searchable_list.get(param1='one', param2='a'), 1) self.assertTrue(searchable_list.get())