def test_find_credentials(self): self.new_credential.save_credential() test_credential = Credential("whatsapp", "manjeru", 12345) test_credential.save_credential() found_credential = Credential.find_by_account('whatsapp') found_credential = found_credential self.assertEqual(found_credential, test_credential)
def test_find_by_account(self): ''' test to check if method to find account by username and password works ''' self.new_credential.save_credentials() twitter = Credential('Wilstan', 'Twitter', 'awilo', '126yzr') twitter.save_credentials() credential_exists = Credential.find_by_account('Twitter') self.assertEqual(credential_exists, twitter)
def test_copy_credential(self): ''' Checking if method to copy credentials works ''' self.new_credential.save_credentials() twitter = Credential('Wilstan', 'Twitter', 'awilo', '126yzr') twitter.save_credentials() find_credential = None for credential in Credential.user_credentials_list: find_credential = Credential.find_by_account(credential.account) return pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.account) self.assertEqual('126yzr', pyperclip.paste()) print(pyperclip.paste())
def find_credential(account): return Credential.find_by_account(account)