def test_add_generate_password(self): """ This will check if the new password added to the list """ new_password = Password("facebook", "6980", Password.generate_(8)) new_password.save_password() self.assertEquall(len(Password.password))
def delete_password(acc): """ This is a function that will delete the password Args: acc - the acc of the pass the user wants to delete """ Password.delete_password(acc)
def password_exists(acc): """ It will check whether a password exists Args: acc- the password's account Return: True or False """ return Password.password_exist(acc)
def generate_password(length): """ This will create a random password for the user Args: length - the user's preferred length for the password Return: It will return a random password of user's preferred length """ return Password.generate_pass(length)
def test_delete(self): """ This test will check whether the password gets deleted from the passwords list """ self.new_password.save_password() new_password = Password("facebook","6980",Password.generate_password(8)) new_password.save_password() Password.delete_password("instagram") self.assertEquall(len(password.password),1)
def test_display_password(self): """ Here it checks weather the display_Password function will return the password in the password list """ self.new_password.test_save_new_password() new_pass = Password("facebook","6980",Password.generate_pass(6)) new_pass.save_pass() self.assertEqual(len(Password.passwords),len(Password.display_passwords()))
def view_passwords(): """ A function that will allow the user to view all the passwords """ return Password.display_passwords()
def setUp(self): ''' Set up method to run before each test cases. ''' self.new_password = Password("Facebook","Vincent Muya","*****@*****.**","fb12345") # create password object
def setUp(self): """ This function will create a new instance password before each test """ self.new_password = Password("slack", "Mutai", "0719")
def find_password(account_name): return Password.find_by_account_name(account_name)
def create_password(aname,uname,email,password): new_password = Password(aname,uname,email,password) return new_password
def test_copy_user_name(self): self.new_password.save_password() Password.copy_user_name("Vincent Muya") self.assertEqual(self.new_password.account_password,pyperclip.paste())
def test_display_all_passwords(self): self.assertEqual(Password.display_passwords(),Password.password_list)
def test_password_exists(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() password_exists = Password.password_exist("user") self.assertTrue(password_exists)
def test_find_password_by_account_name(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() found_password = Password.find_by_account_name("user") self.assertEqual(found_password.account_password,test_password.account_password)
def test_delete_password(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() self.new_password.delete_password() self.assertEqual(len(Password.password_list),1)
class TestPassword(unittest.TestCase): """ Here is where we will perfome all our test """ def setUp(self): """ This function will create a new instance password before each test """ self.new_password = Password("slack", "Mutai", "0719") def tearDown(self): """ Here will be clearing password after every test to avoid confusion """ Password.password = [] def test_new_pass(self): """ Here will test if a new password is initiated correctly """ self.assertEquall(self.new_password.account, "slack") self.assertEquall(self.new_password.username, "Mutai") self.assertEquall(self.new_password.password, "0719") def test_save_new_password(self): """ Here it will check weather the new password is added in the list """ self.new_password.save_password() self.assertEquall(len(Password.paswords), 8) def test_add_generate_password(self): """ This will check if the new password added to the list """ new_password = Password("facebook", "6980", Password.generate_(8)) new_password.save_password() self.assertEquall(len(Password.password)) def test_display_password(self): """ Here it checks weather the display_Password function will return the password in the password list """ self.new_password.test_save_new_password() new_pass = Password("facebook", "6980", Password.generate_pass(6)) new_pass.save_pass() self.assertEqual(len(Password.passwords), len(Password.display_passwords())) def test_delete(self): """ This test will check whether the password gets deleted from the passwords list """ self.new_password.save_password() new_password = Password("facebook", "6980", Password.generate_password(8)) new_password.save_password() Password.delete_password("instagram") self.assertEquall(len(Password.password), 1) def test_password_exist(self): """ This will check whether the password_exists function works """ self.new_password.save_password() self.assertTrue(Password.password_exist("instagram"))
def checking_existing_password(account_name): return Password.password_exist(account_name)
def display_password(): return Password.display_password()
def add_password(account, username, password): """ This is a function that will add a new password to the passwords list """ new_pass = Password(account, username, password) new_pass.save_pass()
def test_password_exist(self): """ This will check whether the password_exists function works """ self.new_password.save_password() self.assertTrue(Password.password_exist("instagram"))
class TestPassword(unittest.TestCase): ''' Test class that defines test cases for the contact class behaviours. ''' def setUp(self): ''' Set up method to run before each test cases. ''' self.new_password = Password("Facebook","Vincent Muya","*****@*****.**","fb12345") # create password object def tearDown(self): Password.password_list = [] def test_init(self): ''' test_init test case to test if the object is initialized properly ''' self.assertEqual(self.new_password.account_name,"Facebook") self.assertEqual(self.new_password.user_name,"Vincent Muya") self.assertEqual(self.new_password.email,"*****@*****.**") self.assertEqual(self.new_password.account_password,"fb12345") def test_save_password(self): self.new_password.save_password() self.assertEqual(len(Password.password_list),1) def test_save_multiple_password(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() self.assertEqual(len(Password.password_list),2) def test_delete_password(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() self.new_password.delete_password() self.assertEqual(len(Password.password_list),1) def test_find_password_by_account_name(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() found_password = Password.find_by_account_name("user") self.assertEqual(found_password.account_password,test_password.account_password) def test_password_exists(self): self.new_password.save_password() test_password = Password("Test","user","*****@*****.**","test12345") test_password.save_password() password_exists = Password.password_exist("user") self.assertTrue(password_exists) def test_display_all_passwords(self): self.assertEqual(Password.display_passwords(),Password.password_list) def test_copy_user_name(self): self.new_password.save_password() Password.copy_user_name("Vincent Muya") self.assertEqual(self.new_password.account_password,pyperclip.paste())