def test_verify_user(self): """ Test to check if we can return a Boolean if the user login deatils don't match. """ self.new_user.save_user() test_user = User("Test", "User", "tuser", "testing20") test_user.save_user() user_verification = User.verify_user("tuser", "testing20") self.assertTrue(user_verification)
def main(): print("Hello, welcome to Password Manager") while True: print("\nPlease use these short codes to execute your desired task: ca - create new account, li - login to account, ex - exit program") short_code = input().lower().strip() if short_code == "ca": fname = input("Enter your first name: ").strip() lname = input("Enter your last name: ").strip() username = input("Enter your preferred username: "******"\nThat username has already been taken. Please enter a different username.") username = input("Enter your preferred username: "******"Enter your password: "******"\nYour new account has been created with the following details:\nName: {fname} {lname}\nUsername: {username}\nPassword: {password}\n") elif short_code == "li": print("\nPlease enter your user details to login.") login_username = input("Enter your username: "******"Enter your password: "******"\nHello {login_username}, please use the following codes to select a task.") while True: print("\ncc - Create Credentials\ndelc - Delete Credential\ndc -Display Credentials\ndsc - Display Specific Credential\nex - Exit") code = input().lower().strip() if code == "cc": app = input("\nEnter the name of the app: ") credential_username = input("Enter your username: "******"\nUse the following options to select which password you prefer\ncp - Custom Password\nap - Auto-Generated Password\nex - Exit") option = input().lower().strip() if option == "cp": credential_password = input("\nEnter your password: "******"ap": credential_password = Credentials.password() break elif option == "ex": break else: print("\nInvalid input. Check options and try again.") new_credential = create_credentials(app, credential_username, credential_password) new_credential.save_credentials() print(f"\nNewly created credential details:\nApp Name: {app}\nUsername: {credential_username}\nPassword: {credential_password}") elif code == "delc": delete_app = input("\nEnter the app name of the credential you wish to delete: ") Credentials.delete_credential(delete_app) print(f"{delete_app} Credentials has been deleted.") elif code == "dc": if Credentials.display_credentials(): for credential in Credentials.display_credentials(): print(f"\nApp: {credential.app}\nUsername: {credential.username}\nPassword: {credential.password}\n") else: print("\nYou haven't created any credentials yet.") elif code == "dsc": app_credential = input("\nEnter app name of the credential you wish to be displayed: ") credential_information = Credentials.display_app_credential(app_credential) if credential_information: print(f"\nApp: {credential_information.app}\nUsername: {credential_information.username}\nPassword: {credential_information.password}") else: print("\nThat credential cannot be found. Please try again") elif code == "ex": break else: print("\nInvalid input. Please check the code and try again.") elif short_code == "ex": break else: print("\nInvalid input. Please check your entry and try again.")