def test_check_user(self): ''' Function to test whether the login in function works ''' self.new_user = User('Tony', 'Kihara', 'tnkz000') self.new_user.save_user() user2 = User('Poul', 'Njenga', 'tnkz000') user2.save_user() for user in User.users_list: if user.first_name == user2.first_name and user.password == user2.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(user2.password, user2.first_name))
def test_check_user(self): ''' Testing whether function to login works properly ''' self.new_user = User('Wilstan', '126yzr') self.new_user.save_user() user2 = User('Ken', '126yzr') user2.save_user() for user in User.users_list: if user.username == user2.username and user.password == user2.password: current_user = user.username return current_user self.assertEqual(current_user, Credential.check_user(user2.password, user2.username))
def test_check_user(self): ''' methode to check if our user login work ''' self.new_user = User("Claudine", "Clauma", "123456", "*****@*****.**") self.new_user.save_user() userOne = User("Claudine", "Clauma", "123456", "*****@*****.**") userOne.save_user() for user in User.user_list: if user.first_name == userOne.first_name and user.password == userOne.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(userOne.password, userOne.first_name))
def test_check_user(self): ''' Function to test whether the login in function check_user works as expected ''' self.new_user = User('Brenda', 'Op\'an\'a', 'pswd100') self.new_user.save_user() user2 = User('Sonn', 'Op\'an\'a', 'pswd100') user2.save_user() for user in User.users_list: if user.first_name == user2.first_name and user.password == user2.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(user2.password, user2.first_name))
def test_check_user(self): ''' Function to test whether the login in function check_user works as expected ''' self.new_user = User('shadrack', 'maestro', 's1234') self.new_user.save_users() addUser = User('', '', '') # test if another user will be added addUser.save_users() for user in User.user_list: if user.username == addUser.username and user.password == addUser.password: current_user = user.username return current_user self.assertEqual( current_user, Credential.check_user(addUser.password, addUser.username))
def test_check_user(self): """ Function to test whether the login in function check_user works as expected """ self.new_user = User("Kellen", "Njoroge", "boo98") self.new_user.save_user() user2 = User("Kellen", "Njoroge", "boo98") user2.save_user() for user in User.users_list: if user.first_name == user2.first_name and user.password == user2.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(user2.password, user2.first_name))
def test_check_user(self): ''' Function to test whether the login in function check_user works as expected ''' self.new_user = User('Charles', 'Ndayisaba', 'ps123') self.new_user.save_user() user2 = User('Geek', 'Ndayisaba', 'ps123') user2.save_user() for user in User.users_list: if user.first_name == user2.first_name and user.password == user2.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(user2.password, user2.first_name))
def test_check_user(self): ''' methode to check if our user login work ''' self.new_user = User("Joselyne", "Ingabire", "23768", "*****@*****.**") self.new_user.save_user() userOne = User("Joselyne", "Ingabire", "23768", "*****@*****.**") userOne.save_user() for user in User.user_list: if user.first_name == userOne.first_name and user.password == userOne.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(userOne.password, userOne.first_name))
def test_check_user(self): ''' methode to check if our user login work ''' self.new_user = User("jeanne", "marie", "dukunde", "*****@*****.**") self.new_user.save_user() userOne = User("jeanne", "marie", "dukunde", "*****@*****.**") userOne.save_user() # current_user='' for user in User.user_list: if user.first_name == userOne.first_name and user.password == userOne.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(userOne.password, userOne.first_name))
def test_check_user(self): ''' methode to check if our user login work ''' self.new_user = User("Deborah", "Debby07", "Ingabineza", "*****@*****.**") self.new_user.save_user() userOne = User("Deborah", "Debby07", "Ingabineza", "*****@*****.**") userOne.save_user() # current_user='' for user in User.user_list: if user.first_name == userOne.first_name and user.password == userOne.password: current_user = user.first_name return current_user self.assertEqual( current_user, Credential.check_user(userOne.password, userOne.first_name))
def verify_user(first_name, password): ''' Function that verifies the existance of the user before creating credentials ''' checking_user = Credential.check_user(first_name, password) return checking_user
def test_check_user(self): ''' Function to test whether the login in function check_user works as expected ''' self.new_user = User('Jacinta', 'At\'ek\'a', 'pswd540') self.new_user.save_user() user2 = User('Mary', 'At\'ek\'a', 'pswd540') user2.save_user() for user in User.users_list: if user.first_name == user2.first_name and user.password == user2.password: current_user = user.first_name return current_user self.assertEqual(current_user,Credential.check_user(user2.password,user2.first_name)) def setUp(self): ''' Function to create an account's credentials before each test ''' self.new_credential = Credential('Jacinta', 'Facebook', 'pswd540') def test__init__(self): ''' Test to if check the initialization/creation of credential instances is properly done ''' self.assertEqual(self.new_credential.user_name, 'Jacinta') self.assertEqual(self.new_credential.site_name, 'Facebook') self.assertEqual(self.new_credential.account_name, 'Jacintaatek') self.assertEqual(self.new_credential.password, 'pswd540') def test_save_credentials(self): ''' Test to check if the new credential info is saved into the credentials list ''' self.new_credential.save_credentials() twitter = credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() self.assertEqual(len(Credential.credentials_list),2) def tearDown(self): ''' Function to clear the credentials list after every test ''' Credential.credentials_list = [] User.users_list = [] def test_display_credentials(self): ''' Test to check if the display_credentials method, displays the correct credentials. ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() gmail = Credential('Mary','Gmail','Jacintaatek','pswd270') gmail.save_credentials() self.assertEqual(len(Credential.display_credentials(twitter.user_name)),2) def test_find_by_site_name(self): ''' Test to check if the find_by_site_name method returns the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() credential_exists = Credential.find_by_site_name('Twitter') self.assertEqual(credential_exists,twitter) def test_copy_credential(self): ''' Test to check if the copy a credential method copies the correct credential ''' self.new_credential.save_credentials() twitter = Credential('Mary','Twitter','Jacintaatek','pswd540') twitter.save_credentials() find_credential = None for credential in Credential.user_credentials_list: find_credential =Credential.find_by_site_name(credential.site_name) return pyperclip.copy(find_credential.password) Credential.copy_credential(self.new_credential.site_name) self.assertEqual('pswd540',pyperclip.paste()) print(pyperclip.paste())
def check_user(first_name,password): ''' check if the account exist ''' checking_user=Credential.check_user(first_name,password) return checking_user
def verify_user(username, password): ''' Verifying the right user to create credentials ''' checking_user = Credential.check_user(username, password) return checking_user
def verify_user(username, password): """ Function that verifies the existance of the user before creating credentials """ checking_user = Credential.check_user(username, password) return checking_user
def verify_user(first_name,password): ''' Function to verify user before creating password ''' checking_user = Credential.check_user(first_name,password) return checking_user