def test_save_credentials(self): ''' Test to check if the new credential info is saved into the credentials list ''' self.new_credential.save_credentials() twitter = Credential('Sonn', 'Twitter', 'Brenda', 'pswd100') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list), 2)
def test_save_credentials(self): ''' Checking if credentials creted are successfully saved to the credentials list ''' self.new_credential.save_credentials() twitter = Credential('Wilstan', 'Twitter', 'awilo', '126yzr') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list), 2)
def test_save_credentials(self): """ Test to check if the new credential info is saved into the credentials list """ self.new_credential.save_credentials() twitter = Credential('Njoroge', 'Twitter', 'Njoroge_Chosen', 'boo98') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list), 9)
def test_save_credentials(self): ''' Test to check if the new credential info is saved into the credentials list ''' self.new_credential.save_credentials() twitter = Credential('Montana', 'Twitter', 'nccharles', 'ps123') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list), 2)
def test_save_credentials(self): ''' Test to check if the new credential info is saved into the credentials list ''' self.new_credential.save_credentials() twitter = Credential('shadrack', 'Twitter', 's1234') twitter.save_credentials() self.assertEqual(len(Credential.cred_list), 2)
def test_save_credentials(self): ''' Test to check if the new credentials are saved ''' self.new_credential.save_credentials() twitter = Credential('Tony', 'Twitter', 'tonkin', 'tnkz000') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list), 2)
def test_find_by_site_name(self): ''' Test to check if the find_by_site_name method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Tony', 'Twitter', 'tonkin', 'tnkz000') twitter.save_credentials() credential_exists = Credential.find_by_site_name('Twitter') self.assertEqual(credential_exists, twitter)
def test_find_by_site_name(self): """ Test to check if the find_by_site_name method returns the correct credential """ self.new_credential.save_credentials() twitter = Credential('Njoroge', 'Twitter', 'Njoroge_Chosen', 'boo98') twitter.save_credentials() credential_exists = Credential.find_by_site_name('Twitter') self.assertEqual(credential_exists, twitter)
def test_find_by_site_name(self): ''' Test to check if the find_by_site_name method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() credential_exists = Credential.find_by_site_name('Twitter') self.assertEqual(credential_exists,twitter)
def test_find_by_site_name(self): ''' Test to check if the find_by_account_type method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('samuel', 'twitter', 'samuel-sam', '120819985') twitter.save_credentials() credential_found = Credential.find_by_site_name('twitter') self.assertEqual(credential_found.password, twitter.password)
def test_credential_exist(self): """ test to check if we can return a true or false based on whether we find or can't find the credential. """ self.new_credential.save_credentials() credential = Credential("user", "site", "pass") credential.save_credentials() credential_is_found = Credential.if_credential_exist("user") self.assertTrue(credential_is_found)
def test_find_by_site_name(self): ''' Test to check if the find_by_site_name method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Montana', 'Twitter', 'nccharles', 'ps123') twitter.save_credentials() credential_exists = Credential.find_by_site_name('Twitter') self.assertEqual(credential_exists, twitter)
def test_save_credentials(self): """ Test to check if the new credential information is saved in the credentials list """ self.new_credential.save_credentials() Instagram = Credential('Elkwal', 'Instagram', 'Elkwal_Simple', 'Elukwal3') Instagram.save_credentials() self.assertEqual(len(Credential.credentials_list), 2)
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_delete_credential(self): """ test method to test if we can remove an account credentials from our cred_list """ self.new_credential.save_credentials() test_credential = Credential("user", "site", "pass") test_credential.save_credentials() self.new_credential.delete_credentials() self.assertEqual(len(Credential.cred_list), 1)
def test_display_credentials(self): ''' Test to check if the display_credentials method, displays the correct credentials. ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() gmail = Credential('Mary','Gmail','Jacintaatek','pswd270') gmail.save_credentials() self.assertEqual(len(Credential.display_credentials(twitter.user_name)),2)
def test_find_by_site_name(self): """ Test to check if the find_by_site_name method returns the correct credential """ self.new_credential.save_credentials() Instagram = Credential('Elkwal', 'Instagram', 'Elkwal_Simple', 'Elukwal3') Instagram.save_credentials() credential_exists = Credential.find_by_site_name('Instagram') self.assertEqual(credential_exists, Instagram)
def test_find_credential(self): """ test to check if we can find a credential entry by account name and display the details of the credential """ self.new_credential.save_credentials() test_credential = Credential("user", "site", "pass") test_credential.save_credentials() credential = Credential.find_credential("user") self.assertEqual(credential.user_name, test_credential.user_name)
def test_display_credentials(self): """ Test to check if the display_credentials method, displays the correct credentials. """ self.new_credential.save_credentials() twitter = Credential('Njoroge', 'Twitter', 'Njoroge_Chosen', 'boo98') twitter.save_credentials() gmail = Credential('Njoroge', 'Gmail', 'Njoroge_Chosen', 'boo98') gmail.save_credentials() self.assertEqual( len(Credential.display_credentials(twitter.user_name)), 3)
def test_display_credentials(self): ''' Test to check if the display_credentials method, displays the correct credentials ''' self.new_credential.save_credentials() twitter = Credential('Tony', 'Twitter', 'tonkin', 'tnkz000') twitter.save_credentials() gmail = Credential('Mary', 'Gmail', 'Virginmary', 'tnkz000') gmail.save_credentials() self.assertEqual( len(Credential.display_credentials(twitter.user_name)), 2)
def test_copy_credential(self): self.new_credential.save_credentials() twitter = Credential('joe','Twitter','joe','pswd100') twitter.save_credentials() find_credential = None for credential in Credential.user_credentials_list: find_credential =Credential.find_by_site_name(credential.site_name) return pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.site_name) self.assertEqual('pswd100',pyperclip.paste()) print(pyperclip.paste())
def test_display_credentials(self): ''' test to check if method to display credentials works ''' self.new_credential.save_credentials() twitter = Credential('Wilstan', 'Twitter', 'awilo', '126yzr') twitter.save_credentials() gmail = Credential('Wilstan', 'Gmail', 'awilo', 'pswd200') gmail.save_credentials() self.assertEqual( len(Credential.display_credentials(twitter.user_name)), 2)
def test_display_credentials(self): ''' Test to check if the display_credentials method, displays the correct credentials. ''' self.new_credential.save_credentials() twitter = Credential('Sonn', 'Twitter', 'Brenda', 'pswd100') twitter.save_credentials() gmail = Credential('sonn', 'Gmail', 'Brenda', 'pswd200') gmail.save_credentials() self.assertEqual( len(Credential.display_credentials(twitter.user_name)), 2)
def test_display_credentials(self): """ Test to check if the display_credentials method, displays the correct credentials. """ self.new_credential.save_credentials() Instagram = Credential('Elkwal', 'Instagram', 'Elkwal_Simple', 'Elukwal3') Instagram.save_credentials() facebook = Credential('Elkwal', 'Facebook', 'Elkwal_Simple', 'Elukwal3') facebook.save_credentials() self.assertEqual( len(Credential.display_credentials(Instagram.user_name)), 2)
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 test_copy_credential(self): ''' Test to check if the copy a credential method copies the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() find_credential = None for credential in Credential.user_credentials_list: find_credential =Credential.find_by_site_name(credential.site_name) return pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.site_name) self.assertEqual('pswd540',pyperclip.paste()) print(pyperclip.paste())
def test_copy_credential(self): """ Test to check if the copy a credential method copies the correct credential """ self.new_credential.save_credentials() twitter = Credential('Njoroge', 'Twitter', 'Njoroge_Chosen', 'boo98') twitter.save_credentials() find_credential = None for credential in Credential.user_credentials_list: find_credential = Credential.find_by_site_name( credential.site_name) return pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.site_name) self.assertEqual('boo98', pyperclip.paste()) print(pyperclip.paste())
def test_copy_credential(self): """ Test to check if the copy a credential method copies the correct credential """ self.new_credential.save_credentials() Instagram = Credential('Sylvia', 'Elkwal', 'sylviaelkwal', 'Elukwal3') Instagram.save_credentials() find_credential = None for credential in Credential.credentials_list: find_credential = Credential.find_by_site_name( credential.site_name) pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.site_name) self.assertEqual('Elukwal3', pyperclip.paste()) print(pyperclip.paste())
def user_name_exist(cls, user_name): ''' Method that checks if a user name exists from the cred list. Args: user_namae: user name to search if it exists Returns : Boolean: True or false depending if the site exists ''' self.new_credential.save_credentials() test_user_name = Credential("user", "site", "pass") # new cred test_user_name.save_credentials() user_name_exists = Credential.user_name_exist("user") self.assertTrue(user_name_exists) for cred in cls.cred_list: if cred.user_name == user_name: return True return False
class TestCredential(unittest.TestCase): def setUp(self): self.new_credential = Credential('samuel', 'twitter', 'samuel-sam', '120819985') def test__init__(self): self.assertEqual(self.new_credential.user_name, 'samuel') self.assertEqual(self.new_credential.site_name, 'twitter') self.assertEqual(self.new_credential.account_name, 'samuel-sam') self.assertEqual(self.new_credential.password, '120819985') # Testing credentials def tearDown(self): Credential.credential_list = [] User.users_list = [] def test_save_credentials(self): self.new_credential.save_credentials() twitter = Credential('samuel', 'twitter', 'samuel-sam', '120819985') twitter.save_credentials() self.assertEqual(len(Credential.credential_list), 2) def test_delete_credentials(self): self.new_credential.save_credentials() twitter = Credential('samuel', 'twitter', 'samuel-sam', '120819985') twitter.save_credentials() twitter.delete_credentials() self.assertEqual(len(Credential.credential_list), 1) def test_find_by_site_name(self): ''' Test to check if the find_by_account_type method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('samuel', 'twitter', 'samuel-sam', '120819985') twitter.save_credentials() credential_found = Credential.find_by_site_name('twitter') self.assertEqual(credential_found.password, twitter.password)