def test_delete_password(self): # check if we can remove password from our list self.password.save_password() test_password = Password("Test", "user", "*****@*****.**", "110p05124h") test_password.save_password() self.new_password.delete_password() # deleting password self.assertEqual(len(Password.password_list), 1)
def test_delete_passwords(self): self.new_password.save_password() test_password = Password("facebook","Zubeir","Abubakar","Black-heart","5250") test_password.save_password() self.new_password.delete_passwords() self.assertEqual(len(Password.password_list),1)
def test_password_exists(self): # checking if we return the booleon if the passoword is not found self.new_password.Password() test_password = Password("Test", "user", "*****@*****.**", "110p05124h") test_password.save_password() password_exists = Password.password_exists("110p05124") self.assertTrue(password_exists)
def test_find_by_email(self): # checking if the password is in the list and the display the info self.new_password.save_password() test_password = Password("Test", "user", "wycliffkerongogmail.com", "110p05124h") test_password.save_password() found_password = Password.find_by_email("31740141") self.assertEqual(found_password.email, password.email)
def test_password_exist(self): self.new_account.save_password() test_password = Password("Test", "user", "0711223344", "*****@*****.**") # new password test_password.save_password() password_exists = Password.password_exist("0711223344") self.assertTrue(password_exists)
def test_delete_password(self): self.new_account.save_password() test_password = Password("Test", "user", "0712345678", "*****@*****.**") # new password test_password.save_password() self.new_account.delete_password() # deleting a password objeect self.assertEqual(len(Password.password_list), 1)
def test_find_password_by_number(self): self.new_account.save_password() test_password = Password("Test", "user", "0711223344", "*****@*****.**") # new password test_password.save_password() found_password = Password.find_by_number("0711223344") self.assertEqual(found_password.email, test_password.email)
def test_save_multiple_password(self): ''' test_save_multiple_password to check if we can save multiple password objects to our password-locker ''' self.new_password.save_password() test_password = Password("jasonmk", "RJXP2I5") test_password.save_password() self.assertEqual(len(Password.password_locker), 2)
def test_save_multiple_password(self): ''' test_save_multiple_password to check if we can save multiple password objects to our password_list ''' self.new_password.save_password() test_password = Password("Micah", "Mutugi", "python") # new password test_password.save_password() self.assertEqual(len(Password.password_list), 2)
def test_save_multiple_password(self): ''' test_save_multiple_password to check if we can save multiple password objects to our password_list ''' self.new_password.save_password() test_password = Password("Test","user","0746432419","*****@*****.**") # new password test_password.save_password() self.assertEqual(len(Password.password_list),2)
def test_delete_password(self): ''' test_delete_password to test if we can remove a password from our password list ''' self.new_password.save_password() test_password = Password("Test","user","0746432419","*****@*****.**") # new password test_password.save_password() self.new_Password.delete_password()# Deleting a password object self.assertEqual(len(Password.password_list),1)
def test_delete_password(self): ''' test_delete_password to test if we can remove a password from our password_locker ''' self.new_password.save_password() test_password = Password("jasonmk", "RJXP2I5") test_password.save_password() self.new_password.delete_password() self.assertEqual(len(Password.password_locker), 1)
def test_save_multiple_password(self): ''' test_save_multiple_contact to check if we can save multiple contact objects to our contact_list ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() self.assertEqual(len(Password.password_list), 2)
def test_find_password_by_number(self): ''' test to check if we can find a password by phone number and display information ''' self.new_password.save_password() test_password = Password("Micah", "Mutugi", "python") # new password test_password.save_password() found_password = Password.find_by_number("python")
def test_delete_password(self): ''' test_delete_password to test if we can remove a password from our password list ''' self.new_password.save_password() test_password = Password("Micah", "Mutugi", "python") # new password test_password.save_password() self.new_password.delete_password() # Deleting a password object self.assertEqual(len(Password.password_list), 1)
class TestPassword(unittest.TestCase): def setUp(self): self.new_account = Password( "James", "Muriuki", "0712345678", "*****@*****.**") # create password object def tearDown(self): Password.password_list = [] def test_init(self): self.assertEqual(self.new_account.first_name, "James") self.assertEqual(self.new_account.last_name, "Muriuki") self.assertEqual(self.new_account.phone_number, "0712345678") self.assertEqual(self.new_account.email, "*****@*****.**") def test_save_password(self): self.new_account.save_password() # saving the new password self.assertEqual(len(Password.password_list), 1) def test_save_multiple_password(self): self.new_account.save_password() test_password = Password("Test", "user", "0712345678", "*****@*****.**") # new password test_password.save_password() self.assertEqual(len(Password.password_list), 2) def test_delete_password(self): self.new_account.save_password() test_password = Password("Test", "user", "0712345678", "*****@*****.**") # new password test_password.save_password() self.new_account.delete_password() # deleting a password objeect self.assertEqual(len(Password.password_list), 1) def test_find_password_by_number(self): self.new_account.save_password() test_password = Password("Test", "user", "0711223344", "*****@*****.**") # new password test_password.save_password() found_password = Password.find_by_number("0711223344") self.assertEqual(found_password.email, test_password.email) def test_password_exist(self): self.new_account.save_password() test_password = Password("Test", "user", "0711223344", "*****@*****.**") # new password test_password.save_password() password_exists = Password.password_exist("0711223344") self.assertTrue(password_exists) def test_display_all_passwords(self): self.assertEqual(Password.display_passwords(), Password.password_list)
def test_password_exists(self): ''' test to check if we can return a Boolean if we cannot find the password. ''' self.new_password.save_password() test_password = Password("jasonmk", "RJXP2I5") test_password.save_password() password_exists = Password.password_exist("jasonmk") self.assertTrue(password_exists)
def test_delete_password(self): ''' test_delete_contact to test if we can remove a contact from our contact list ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772575", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() self.new_password.delete_password() # Deleting a contact object self.assertEqual(len(Password.password_list), 1)
def test_password_exists(self): ''' test to check if we can return a Boolean if we cannot find the contact. ''' self.new_password.save_password() test_password = Password("Micah", "Mutugi", "python") # new password test_password.save_password() password_exists = Password.password_exist("python") self.assertTrue(password_exists)
def test_password_exists(self): ''' test to check if we can return a Boolean if we cannot find the contact. ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() password_exists = Password.password_exist("0740772578") self.assertTrue(password_exists)
def test_find_password_by_number(self): ''' test to check if we can find a contact by phone number and display information ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() found_password = Password.find_by_number("0740772578") self.assertEqual(found_password.email, test_password.email)
def test_find_password_by_number(self): ''' test to check if we can find a password by phone number and display information ''' self.new_contact.save_contact() test_password = Password("Test","user","0746432419","*****@*****.**") # new password test_password.save_password() found_password = Password.find_by_number("0746432419") self.assertEqual(found_password.email,test_password.email) if __name__ == '__main__': unittest.main()
class TestPassword(unittest.TestCase): ''' Test class that defines test cases for the contact class behaviours. Args: unittest.TestCase:TestCase class that helps in creating test cases ''' def setUp(self): ''' Set up method to run before each test cases. ''' self.new_password= Password("LMT936!") #generate new password def test_init(self): ''' Set up method to run before each test cases. ''' self.assertEqual(self.new_password.random_password,"LMT936!") def test_save_password(self): ''' test to see if the password has saved. ''' self.new_password.save_password() self.assertEqual(len(Password.password_list),1) def test_password_length(self): ''' test to see if the password has reached the character limit ''' self.new_password.password_length() self.assertTrue(len(Password.password_length),5) def tearDown(self): ''' tearDown method that does clean up after each test case has run. ''' Password.password_list=[]
class Testpassword(unittest.TestCase): def setUp(self): self.new_password = Password("Instagram", "Lorderonnie", "421145") def tearDown(self): Password.password_list = [] def test_init(self): self.assertEqual(self.new_password.app_name, "Instagram") self.assertEqual(self.new_password.user_name, "Lorderonnie") self.assertEqual(self.new_password.password_number, "421145") def test_save_password(self): self.new_password.save_password() self.assertEqual(len(Password.password_list), 1) def test_save_multiple_passwords(self): self.new_password.save_password() test_password = Password("Instagram", "Lorderonnie", "421145") test_password.save_password() self.assertEqual(len(Password.password_list), 2) def test_delete_password(self): self.new_password.save_password() test_password = Password("Instagram", "Lorderonnie", "421145") test_password.save_password() self.new_password.delete_password() self.assertEqual(len(Password.password_list), 1) def test_display_all_contacts(self): self.assertEqual(Password.display_passwords(), Password.password_list)
class TestPassword(unittest.TestCase): def setUp(self): ''' set up method to run before each test case ''' self.new_password = Password("instagram","zubeir","Abubakar","Black-heart","5250") def test_init(self): ''' def test_init test case to see if the object is initialized correctly ''' self.assertEqual(self.new_password.smedia,"instagram") self.assertEqual(self.new_password.first_name,"zubeir") self.assertEqual(self.new_password.last_name,"Abubakar") self.assertEqual(self.new_password.user_name,"Black-heart") self.assertEqual(self.new_password.password,"5250") def tearDown(self): Password.password_list = [] def test_save_password(self): self.new_password.save_password() self.assertEqual(len(Password.password_list),1) def test_save_mulitple_password(self): self.new_password.save_password() test_password = Password("Snapchat","zubeir","Abubakar","Black-heart","5250") test_password.save_password() self.assertEqual(len(Password.password_list),2) def test_delete_passwords(self): self.new_password.save_password() test_password = Password("facebook","Zubeir","Abubakar","Black-heart","5250") test_password.save_password() self.new_password.delete_passwords() self.assertEqual(len(Password.password_list),1) def test_display_all_passwords(self): self.assertEqual(Password.display_passwords(),Password.password_list)
class Testpasswordnew_password(unittest.TestCase): # Items up here ....... def setUp(self): ''' Set up method to run before each test cases. ''' self.new_password = Password( 'Evans', 'Opindi', '0740772578', '*****@*****.**', 'evracheche1999') # create passwordnew_password object def test_init(self): ''' test_init test case to test if the object is initialized properly ''' self.assertEqual(self.new_password.first_name, "Evans") self.assertEqual(self.new_password.last_name, "Opindi") self.assertEqual(self.new_password.phone_number, "0740772578") self.assertEqual(self.new_password.email, "*****@*****.**") self.assertEqual(self.new_password.password, "evracheche1999") def test_save_password(self): ''' test_save_password test case to test if the password object is saved into the password list ''' self.new_password.save_password() # saving the new password self.assertEqual(len(Password.password_list), 1) # setup and class creation up here def tearDown(self): ''' tearDown method that does clean up after each test case has run. ''' Password.password_list = [] # other test cases here def test_save_multiple_password(self): ''' test_save_multiple_contact to check if we can save multiple contact objects to our contact_list ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() self.assertEqual(len(Password.password_list), 2) # More tests above def test_delete_password(self): ''' test_delete_contact to test if we can remove a contact from our contact list ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772575", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() self.new_password.delete_password() # Deleting a contact object self.assertEqual(len(Password.password_list), 1) def test_find_password_by_number(self): ''' test to check if we can find a contact by phone number and display information ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() found_password = Password.find_by_number("0740772578") self.assertEqual(found_password.email, test_password.email) def test_password_exists(self): ''' test to check if we can return a Boolean if we cannot find the contact. ''' self.new_password.save_password() test_password = Password("Test", "user", "0740772578", "*****@*****.**", "evracheche1999") # new contact test_password.save_password() password_exists = Password.password_exist("0740772578") self.assertTrue(password_exists) def test_display_all_password(self): ''' method that returns a list of all contacts saved ''' self.assertEqual(Password.display_password(), Password.password_list) def test_copy_email(self): ''' Test to confirm that we are copying the email address from a found contact ''' self.new_password.save_password() Password.copy_email("0740772578") self.assertEqual(self.new_password.email, pyperclip.paste())
def test_save_mulitple_password(self): self.new_password.save_password() test_password = Password("Snapchat","zubeir","Abubakar","Black-heart","5250") test_password.save_password() self.assertEqual(len(Password.password_list),2)