def test_verify(self): ''' Testing to see if it can sign in a user ''' self.new_user.usercreation() test_account = Login("skank", "picklerick", "password") test_account.usercreation() found_user = Login.loginverify("picklerick", "password") self.assertEqual(found_user.username, test_account.username)
class TestLogin(unittest.TestCase): ''' Testclass that defines login class behaviours Args: unittest.Testcase class helps in creating test cases. ''' def setUp(self): ''' Setup method to run each test cases. ''' self.new_user = Login("skankhunt42", "*****@*****.**", "123456") #create login object def test_init(self): ''' test_init test case to test if object is initialized properly ''' self.assertEqual(self.new_user.username, "skankhunt42") self.assertEqual(self.new_user.email, "*****@*****.**") self.assertEqual(self.new_user.password, "123456") def test_usercreation(self): ''' test_save_passlock test case to test if the password object is saved into the login list ''' self.new_user.usercreation() #saving the new password self.assertEqual(len(Login.login_list), 1) def tearDown(self): ''' cleans up after each test has run ''' Login.login_list = [] def test_verify(self): ''' Testing to see if it can sign in a user ''' self.new_user.usercreation() test_account = Login("skank", "picklerick", "password") test_account.usercreation() found_user = Login.loginverify("picklerick", "password") self.assertEqual(found_user.username, test_account.username)
def copy_password(number, count): ''' This is a function that copies the password to the clipboard ''' Login.copy_password(number, count)
def data_existing(data): ''' This is a function that checks if user data exists ''' return Login.existing_data(data)
def dispay_data(data, number): ''' This is a function that displays the user data ''' return Login.display_data(data, number)
def new_account(username, email, password): ''' Function to create new account ''' new_user = Login(username, email, password) return new_user
def my_new_data(userid, webkey, website): ''' This is a function that creates data for storing password ''' new_data = Login(userid, webkey, website) return new_data
def verify(username, passkey): ''' Function that verifies and enables login ''' return Login.loginverify(username, passkey)
def setUp(self): ''' Setup method to run each test cases. ''' self.new_user = Login("skankhunt42", "*****@*****.**", "123456") #create login object