def test_contact_exists(self): self.new_contact.save_contact() test_contact = Contact("Test", "user", "071234678", "*****@*****.**") #new contact test_contact.save_contact() contact_exists = Contact.contact_exists("0712345678") self.assertTrue(contact_exists)
def setUp(self): self.new_contact = Contact("John", "Doe", "0749319133", "*****@*****.**") #create contact object
def test_find_contact_by_number(self): self.new_contact.save_contact() test_contact = Contact("Test", "user", "0712345678", "*****@*****.**") test_contact.save_contact() found_contact = Contact.find_by_number("0712345678") self.assertEqual(found_contact.email, test_contact.email)
def test_delete_contact(self): self.new_contact.save_contact() test_contact = Contact("Test", "user", "0712345678", "*****@*****.**") test_contact.save_contact() self.new_contact.delete_contact() self.assertEqual(len(Contact.contact_list), 1)
def test_save_multiple_contact( self): #checks if one can save multiple contacts self.new_contact.save_contact() test_contact = Contact("Test", "user", "0712345678", "*****@*****.**") test_contact.save_contact() self.assertEqual(len(Contact.contact_list), 2)
def create_contact(fname, lname, phone, email): new_contact = Contact(fname, lname, phone, email) return new_contact
def display_contacts(): return Contact.display_contacts()
def check_existing_contacts(number): return Contact.contact_exist(number)
def find_contact(number): return Contact.find_by_number(number)