def save_user_account(user_account): ''' allows us to save the system users once they create their logins :param user_account: :return: ''' UserAccounts.save_user_account(user_account)
def create_user_accounts(account_name,account_password): ''' to allow us create users to login and use the system :param your_name: :param your_password: :return: ''' new_user_account = UserAccounts(account_name, account_password) return new_user_account
def user_authentication(account_name, account_password): ''' to check user logins and log the user to the system :param your_name: :param your_password: :return: ''' confirm_app_user=UserAccounts.confirm_app_user(account_name, account_password) return confirm_app_user
def test_confirm_app_user(self): ''' Function to confirm login details to current user ''' self.new_user = UserAccounts("cherucole", "accpass") self.new_user.save_user_account() test_user = UserAccounts("cherucole", "accpass") test_user.save_user_account() active_user = UserAccounts.confirm_app_user("cherucole", "accpass") self.assertTrue(active_user)
class TestUserAccounts(unittest.TestCase): def setUp(self): ''' Function to help create user a/c details before each test ''' self.new_user = UserAccounts("cherucole", "accpass") def test_init_(self): ''' Test to check creation of new user instance ''' self.assertEqual(self.new_user.account_name, "cherucole") self.assertEqual(self.new_user.account_password, "accpass") def test_confirm_app_user(self): ''' Function to confirm login details to current user ''' self.new_user = UserAccounts("cherucole", "accpass") self.new_user.save_user_account() test_user = UserAccounts("cherucole", "accpass") test_user.save_user_account() active_user = UserAccounts.confirm_app_user("cherucole", "accpass") self.assertTrue(active_user)
def setUp(self): ''' Function to help create user a/c details before each test ''' self.new_user = UserAccounts("cherucole", "accpass")
def display_user_accounts(): """ To view all system users that have been saved """ return UserAccounts.display_user_accounts()
class TestUserAccounts(unittest.TestCase): # setup and class creation up here def tearDown(self): ''' tearDown method that does clean up after each test case has run. ''' accounts.accounts_list = [] # other test cases here def test_save_multiple_accounts(self): ''' test_save_multiple_accounts to check if we can save multiple contact objects to our accounts_list ''' self.new_contact.save_account() test_account = account("Test", "account") test_contact.saveaccount() self.assertEqual(len(user.account_list), 2) # More tests above def test_delete_user(self): ''' test_delete_user to test if we can remove an account from our user list ''' self.new_user.save_account() test_account = User("Test", "account") # new user test_account.save_user() def setUp(self): ''' Function to help create user a/c details before each test ''' self.new_user = UserAccounts("phoebe", "1998") def test_init_(self): ''' Test to check creation of new user instance ''' self.assertEqual(self.new_user.account_name, "phoebe") self.assertEqual(self.new_user.account_password, "1998") def test_save_account_user(self): ''' test_save_multiple_contact to check if we can save multiple account objects to our user_list ''' self.new_contact.save_user() # test_contact = user("name","password) # new contact test_contact.save_user() self.assertEqual(len(User.user_list), 2) def test_confirm_app_user(self): ''' Function to confirm login details to current user ''' self.new_user = UserAccounts("phoebe", "1998") self.new_user.save_user_account() test_user = UserAccounts("phoebe", "1998") test_user.save_user_account() active_user = UserAccounts.confirm_app_user("phoebe", "1998") self.assertTrue(active_user)
def setUp(self): ''' Function to help create user a/c details before each test ''' self.new_user = UserAccounts("phoebe", "1998")