def test_get_exams(self): events = factories.EventFactory.create_batch(random.randint(50, 100)) events.append(self.event) get_exams_res = Event.get_exams() filtered_events = [x for x in events if x.type == Event.TYPE_EXAM] self.assertEqual(len(get_exams_res), len(filtered_events)) get_exams_pk = [x.pk for x in get_exams_res] for i in range(0, len(filtered_events)): self.assertTrue(filtered_events[i].pk in get_exams_pk)
def items(self): return Event.get_exams()[:10]