def reg_new_platform(): nw_platform = input( 'Enter platform e.g. Facebook,Google, Instagram etc.: ') nw_username = input('Enter account username/email: ') nw_password = input( 'Type password or type AUTO to auto-generate password: '******'auto' or nw_password == 'AUTO'): nw_password = userAccounts.random_password( int(input('Enter preferred length: '))) print(f'Your password is {nw_password}') else: if (input('Confirm your password: '******'Passwords didn\'t match') main() new_account = userAccounts(nw_platform, nw_username, nw_password) userAccounts.add_account(new_account) print(f'Account {nw_username} added to platform {nw_platform}') if input('Type CP to copy password').lower() == 'cp': pyperclip.copy(nw_password) print(f'Password of {nw_username } copied to clipboard') if input( 'Type LS to list all your credentials or press any key to return to main' ).lower() == 'ls': userAccounts.list_all_credentials() else: login_account() reg_new_platform()
def test_get_account(self): ''' test case that checks if an account is already registered. If it is registered, it returns the account ''' userAccounts.add_account(self.new_account) get_account = userAccounts.get_account('instagram', 'cephaske254') self.assertEqual(get_account.username, 'cephaske254') self.assertEqual(get_account.email, '*****@*****.**')
def reg_existing_platform(): ex_platform = input( 'Enter platform e.g. Facebook,Google, Instagram etc.: ') ex_username = input('Enter account username/email: ') if (userAccounts.account_exist(ex_platform, ex_username)): print( 'Account on {ex_platform} already registered with username/email {ex_username}' ) else: ex_password = input('Enter account password: '******'Account {ex_username} added to platform {ex_platform}')
def test_account_exist(self): ''' test case that checks if an account is already registered. If it is registered, it returns the account ''' userAccounts.add_account(self.new_account) self.assertTrue(userAccounts.account_exist('instagram', 'cephaske254'))
def test_add_account(self): ''' test case that checks if user accounts are being added to the accounts list ''' userAccounts.add_account(self.new_account) self.assertEqual(len(userAccounts.accounts), 1)