def test_queryset_read(self): found = False index = InstitutionIndex() for obj in index.read_queryset(): found = True self.assertFalse(hasattr(obj, 'num_loans')) self.assertTrue(found)
def test_queryset_num_loans(self): found1, found2 = False, False index = InstitutionIndex() for obj in index.index_queryset(): if obj.respondent_id == '9876543210': found1 = True self.assertEqual(obj.num_loans, 1) elif obj.respondent_id == '0123456789': found2 = True self.assertTrue(found1) self.assertFalse(found2)