def setUp(self): """ function that provides default values for the test cases """ self.new_user_credentials = Credentials('facebook', 'diella', 'diella26')
def test_save_many_credentials(self): """ test method to check if we can save multiple credentials """ self.new_credential.save_credential() test_credential = Credentials("Twitter","instant messenger","2222") test_credential.save_credential() self.assertEqual(len(Credentials.credential_list),2)
def test_save_multiple_credenials(self): """ test to see if user can save multiple credentials """ self.new_user_credentials.save_existing_acc() test_credentials = Credentials('instagram', 'micha', 'micha8') test_credentials.save_existing_acc() self.assertEqual(len(Credentials.user_credential_list), 2)
def test_save_multiple_account(self): ''' test_save_multiple_account to check if multiple accounts can be saved ''' self.new_account.save_account() test_account = Credentials("Instagram", "Test", "user123") # new account test_account.save_account() self.assertEqual(len(Credentials.accounts_list), 2)
def test_delete_credential(self): """ method that deletes user credentials account from a list """ self.new_credential.save_credential() test_credential = Credentials("Twitter","instant messenger","2222") test_credential.save_credential() self.new_credential.delete_credential() #deletes a credenial self.assertEqual(len(Credentials.credential_list),1)
def test_find_credential(self): """ method to test whether we can find the specific credential in our credential list """ self.new_credential.save_credential() test_credential = Credentials("Twitter","instant messenger","2222") test_credential.save_credential() find_credential = Credentials.find_by_name("Twitter") self.assertEqual(find_credential.description,test_credential.description)
def test_account_exists(self): """ Test to check if a certain account exists and returns a boolean value """ self.new_user_credentials.save_existing_acc() test_account = Credentials('Facebook', 'diella', 'diella26') test_account.save_existing_acc() account_exists = Credentials.account_exists('diella') self.assertTrue(account_exists)
def test_delete_account(self): ''' test_delete_account to test if an account can be removed from list ''' self.new_account.save_account() test_account = Credentials("Instagram", "Test", "user123") # new account test_account.save_account() self.new_account.delete_account() # Deleting account self.assertEqual(len(Credentials.accounts_list), 1)
def test_gen_password(self): ''' Test to generate password for account ''' account = Credentials.gen_password("Facebook") test_account = Credentials("Facebook", "Nakish", account) test_account.save_account() test_account.password = Credentials.gen_password(test_account) self.assertEqual(test_account.password, account)
def test_credential_exists(self): """ test to see if a credential is in the credentials list """ self.new_credential.save_credential() test_credential = Credentials("Twitter","instant messenger","2222") test_credential.save_credential() credential_exist = Credentials.credential_check("Twitter") self.assertTrue(credential_exist)
def test_delete_credentials(self): """ test to see if user can delete existing credentials """ self.new_user_credentials.save_existing_acc() test_credential = Credentials('slack', 'micha', 'micha8') test_credential.save_existing_acc() self.new_user_credentials.delete_user_credentials() self.assertEqual(len(Credentials.user_credential_list), 1)
def test_find_credentials(self): """ Test to see if a user can search for a specific account in the application """ self.new_user_credentials.save_existing_acc() test_account = Credentials('Facebook', 'diella', 'diella26') test_account.save_existing_acc() found_account = Credentials.find_by_username('diella') self.assertEqual(found_account.acc_name, test_account.acc_name)
def test_find_account(self): ''' test to check accounts by accountName and display information ''' self.new_account.save_account() test_account = Credentials("Instagram", "Test", "user123") # new account test_account.save_account() found_account = Credentials.find_account("Instagram") self.assertEqual(found_account.password, test_account.password)
def test_account_exists(self): ''' test to check if we can return a Boolean if we cannot find account. ''' self.new_account.save_account() test_account = Credentials("Instagram", "Test", "user123") # new account test_account.save_account() account_exists = Credentials.account_exist("Instagram") self.assertTrue(account_exists)
def create_account(accountName,username,password): ''' Function to create a new account ''' new_account = Credentials(accountName,username,password) return new_account
def create_credential(account_name, description, password): """ function to create new credential """ new_credential = Credentials(account_name, description, password) return new_credential
def create_new_credentials(acc_name, acc_username, acc_password): """ Funtion for creating new user credentials """ new_user_credentials = Credentials(acc_name, acc_username, acc_password) return new_user_credentials
def setUp(self): ''' Set up method to run before each test cases. ''' self.new_account = Credentials("Twitter", "Muriuki", "Muri5678") # create Credentials object
def setUp(self): """ set up method to run before each test cases. """ self.new_credential = Credentials("Facebook","social media account","space\11")
def main(): while True: print( "Welcome to password Locker! the best website to store all of your important acouont details use cn - create new account/sign up or l - login to an existing account or x - exit the application" ) print("\n") code = input().lower() if code == 'cn': print("New Account") print("\n") print("Enter First Name") first_name = input() print("Enter Last Name") last_name = input() print("Enter Email Address") email = input() print("Enter Password") password = input() print("\n") save_account(create_account(first_name, last_name, email, password)) #new account print("\n") print("creating...10%...50%.......80%") print("done 100%") print("\n") print( f"Created account for {first_name} {last_name} with email {email}" ) print("\n") elif code == 'l': print("Enter an email address for your user account") search_email = input() print("Enter a password for your user account") search_password = input() if check_users(search_email, search_password): search_account = login_user(search_email, search_password) print(f"searching {search_email}.........") print("\n") print( f"Welcome {search_account.first_name} {search_account.last_name}! Follow the instructions below to get started." ) print( f"UserName: {search_account.first_name} {search_account.last_name}" ) print(f"Email Address: {search_account.email}") print("\n") print( "Enter n to create a new credential, np to create new credential with autogenerated password v to view a list of your credentials, s to search for a specific credential or b to go back" ) enter = input().lower() if enter == 'n': print("New Credentials") print("\n") print("Enter Name") account_name = input() print("Enter Description") description = input() print("Enter Password") password2 = input() print("\n") save_credential( create_credential(account_name, description, password2)) #new credential print("\n") print("done 100%") print("\n") print( f"Created credentials ACCOUNT NAME:{account_name} DESCRIPTION:{description} PASSWORD:{password2}" ) print("\n") check_users(search_email, search_password) search_account = login_user(search_email, search_password) print( "You have succesfully created your first credential login again to view your list of credentials" ) elif enter == 'np': print("\n") print("New Account") print("-" * 10) print("Enter Name") account_name = input() print("Enter Description") description = input() save_credential( Credentials(account_name, description, (generate_password(account_name)))) print("\n") print(f"{account_name}, you have created a new account") print("\n") elif enter == 's': print("Enter Credential Name") credential_name = input() if check_credential(credential_name): search_credential = get_credential(credential_name) print("searching.........") print("\n") print( f"CREDENTIAL NAME: {search_credential.account_name}" ) print(f"DESCRITPION: {search_credential.description}") print(f"PASSWORD: {search_credential.password}") print("\n") else: print( "sorry that credential does not exist! please try again." ) print("\n") elif enter == 'v': if list_credentials(): print("Here is a list of all your credentials") print('\n') for credential in list_credentials(): print( f"ACCOUNT NAME: {credential.account_name} DESCRIPTION: {credential.description } PASSWORD: {credential.password}" ) print("\n") else: print("\n") print("You dont have any credentials saved yet!") print("\n'") elif enter == 'b': main() else: print( "sorry you did not enter either of the code provided above, please enter one of the code provided above!" ) print("\n") else: print( "That user account does not exist please sign up t create a new account!" ) print("\n") elif code == 'x': print("Nooooooo....don't go!") break else: print( "sorry you did not enter either of the codes provided above, please enter the codes provided above!" ) print("\n")