def test_get_invalid_criminal_record(self): person = Person( id_type="CC", id_number="", id_exp_date=date(2001, 1, 11), full_name="John Doe", email="*****@*****.**", phone_number="1234567890" ) criminal_record = get_criminal_record(person=person) self.assertIsNone(criminal_record)
def test_get_score(self): person = Person( id_type="CC", id_number="1000000", id_exp_date=date(2001, 1, 11), full_name="John Doe", email="*****@*****.**", phone_number="1234567890" ) score = get_score(person=person) self.assertIsInstance(score, int)
def test_save_contact(self): directory = Directory() person = Person(id_type="CC", id_number="1000000", id_exp_date=date(2001, 1, 11), full_name="John Doe", email="*****@*****.**", phone_number="1234567890") directory._save_contact(person) contacts = directory.contacts self.assertEqual(len(contacts), 1) self.assertIsInstance(contacts[0], Contact)
def test_is_not_personal_data_valid(self): person = Person(id_type="CC", id_number="1000000", id_exp_date=date(2001, 1, 11), full_name="John Doe", email="*****@*****.**", phone_number="1234567890") personal_data = { "id_type": "CC", "id_number": "1000000", "id_exp_date": "2001-01-11", "full_name": "Jean Smith" } result = PersonalDataValidator._is_personal_data_valid( person, personal_data) self.assertFalse(result)
def test_create_person(self): data = { "id_type": "CC", "id_number": "1000000", "id_exp_date": date(2001, 1, 11), "full_name": "John Doe", "email": "*****@*****.**", "phone_number": "1234567890" } person = Person(**data) self.assertIsInstance(person, Person) self.assertEqual(person.id_type, data["id_type"]) self.assertEqual(person.id_number, data["id_number"]) self.assertEqual(person.id_exp_date, data["id_exp_date"].strftime(Person.DATE_FORMAT)) self.assertEqual(person.full_name, data["full_name"]) self.assertEqual(person.email, data["email"]) self.assertEqual(person.phone_number, data["phone_number"])