def test_is_data_in_template_and_database_same(self): """ Check that data in template and DB same. """ SimplePersonFactory.create() contact = Person.objects.last() self.assertEqual(check_content_in_template(contact), True) contact.name = "test_is_data_in_template_and_database_same" contact.save() self.assertEqual(check_content_in_template(contact), True)
def test_for_existing_person(self): """ Check DB for get info. """ contact = SimplePersonFactory.create() check_data = SimplePersonFactory.attributes() self.assertEqual(check_db_content(contact, check_data), True)
def test_add_new_person_and_delete(self): """ Check can add and delete date from DB. """ Person.objects.all().delete() contact = SimplePersonFactory.create() check_data = SimplePersonFactory.attributes() self.assertEqual(check_db_content(contact, check_data), True) Person.objects.last().delete() self.assertEqual(Person.objects.count(), 0)
def test_main_page_if_in_database_more_that_one_record(self): """ Check case what return in template if DB have more that one record. """ counter = 1 while Person.objects.count() <= 1: contact = SimplePersonFactory.create() contact.name += str(counter) contact.last_name += str(counter) contact.save() counter += 1 contact_new = Person.objects.last() self.assertEquals(check_content_in_template(contact_new), True)