def create_account(users_name, username, password): """ function to create new credentials for a new account """ new_account = User(users_name) new_account = Credentials(username, password) return new_account
def test_save_multiple_credentials(self): """test to check if we can save multiple account credentials. """ self.new_account.save_credentials() test_credentials = Credentials("InstaJames", "Hello000") #new account test_credentials.save_credentials() self.assertEqual(len(Credentials.account_list), 2)
def test_save_multiple_accounts(self): ''' tests to check if we can solve multiple credential objects to our account_list ''' self.new_account.save_account() test_account = Credentials(1,"Jerusha","Auma","*****@*****.**", "jeru") #new account test_account.save_account() self.assertEqual(len(Credentials.account_list),2)
def test_find_credentials_by_username(self): """ test to check if we can find the credentials using just the username """ self.new_account.save_credentials() test_credentials = Credentials("InstaJames", "test") #new contact test_credentials.save_credentials() found_credentials = Credentials.find_by_username("InstaJames") self.assertEqual(found_credentials.password, test_credentials.password)
def test_delete_credentials(self): """ test to see if we can remove account credentials from our list """ self.new_account.save_credentials() test_credentials = Credentials("FbJames", "Facebook") #new credentials test_credentials.save_credentials() self.new_account.delete_credentials() #deleting a credentials object self.assertEqual(len(Credentials.account_list), 1)
def test_delete_account(self): ''' tests if we can remove an account from account_list ''' self.new_account.save_account() test_account = Credentials(1,"Jerusha","Auma","*****@*****.**", "jeru") test_account.save_account() self.new_account.delete_account() #Deleting a credential object self.assertEqual(len(Credentials.account_list),1)
def test_auhenticate(self): ''' test to check if we can restrict access by password authentication ''' self.new_account.save_account() test_account = Credentials(1,"Jerusha","Auma","*****@*****.**", "jeru") test_account.save_account() found_account = Credentials.authenticate_account("Jerusha","jeru") self.assertEqual(found_account.user_id, test_account.user_id)
def create_account(user_id, first_name, last_name, email, password): ''' Function to create a new account ''' new_account = Credentials(user_id, first_name, last_name, email, password) return new_account
def setUp(self): """ The setup method is used to run before each testcase. """ self.new_account = Credentials("TwitterJames", "12345678") #create credentials object
def setUp(self): ''' Set up method to run before each test cases. ''' self.new_account = Credentials(1,"Michel","Atieno","*****@*****.**","michel") #create new object