def test_find_credential_by_username(self): """ test to check if we can find a user by his name """ self.new_credential.save_credential() test_credential = Credential("Arijm", "*****@*****.**", "instagram", "mango") #new credential test_credential.save_credential() found_credential = Credential.find_by_user_name("Arijm") self.assertEqual(found_credential.user_name, test_credential.user_name)
def test_find_credential(self): ''' function for test case to test if we can find the credential object from the list ''' self.new_credential.save_credential() test_credential=Credential("kingkong","qweasdzxc","facebook") test_credential.save_credential() find_credential=Credential.find_by_user_name("kingkong")# finding the credential by its user_name self.assertEqual(find_credential.user_name,test_credential.user_name)
def test_copy_credential(self): ''' function for test case to see if can copy a credential ''' self.new_credential.save_credential() test_credential=Credential("kingkong","qweasdzxc","facebook")# new object test_credential.save_credential()# save the object find_credential=None for credential in Credential.credential_list: found_credential=Credential.find_by_user_name(credential.user_name) return pyperclip.copy(found_credential.password) Credential.copy_credential(self.new_credential.user_name) self.assertEqual("qweasdzxc",pyperclip.paste())
def find_credential(user_name): ''' function that finds a credential by username and returns the credential ''' return Credential.find_by_user_name(user_name)
def find_credential(user_name): ''' function to find credential ''' return Credential.find_by_user_name(user_name)