def test_find_by_with_full_registration_id(self): tmp_student = StudentFactory() db_student = list( student.find_by(registration_id=tmp_student.registration_id, full_registration=True))[0] self.assertIsNotNone(db_student) self.assertEqual(db_student.registration_id, tmp_student.registration_id)
def test_find_by_with_username(self): tmp_student = StudentFactory() db_student = list( student.find_by(person_username=tmp_student.person.user))[0] self.assertIsNotNone(db_student) self.assertEqual(db_student, tmp_student)
def test_find_by_with_person_last_name_case_insensitive(self): a_person = PersonFactory.create(last_name="Smith", user=None) a_student = StudentFactory.create(person=a_person) found = list(student.find_by(person_name="smith")) self.assertEqual(len(found), 1) self.assertEqual(found[0].id, a_student.id)
def test_find_by_with_person_first_name_case_insensitive(self): a_person = PersonWithoutUserFactory.create(first_name="John") a_student = StudentFactory.create(person=a_person) found = list(student.find_by(person_first_name="john")) self.assertEqual(len(found), 1) self.assertEqual(found[0].id, a_student.id)