def test_copy_password(self): ''' Testing if the copy password function works ''' self.new_data.add_password() UsersInfo.copy_password(1, 1) self.assertEqual(self.new_data.web_pass, pyperclip.paste())
def test_data_exists(self): ''' Testing to check if the function for checking data works well ''' self.new_data.add_password() test_data = UsersInfo(1, 1, "gmail.com", "kiriu") test_data.add_password() data_exists = UsersInfo.existing_data(1) self.assertTrue(data_exists)
def test_display_data(self): ''' Testing if the data can be displayed. ''' self.new_data.add_password() test_data = UsersInfo(1, 1, "gmail.com", "kiriu") test_data.add_password() data_found = UsersInfo.display_data(1, 1) self.assertEqual(data_found.website, test_data.website)
class TestUserData(unittest.TestCase): ''' Test class that defines the test cases for creating websites log in credentials ''' def setUp(self): ''' Setting up the structure before each test ''' self.new_data = UsersInfo(1, 1, "gmail.com", "madashmartin") def tearDown(self): ''' Cleans up the test after test is complete ''' UsersInfo.data_list = [] def test_init(self): ''' Test case to evaluate if the case has been initialized properly ''' self.assertEqual(self.new_data.ident, 1) self.assertEqual(self.new_data.id, 1) self.assertEqual(self.new_data.website, "gmail.com") self.assertEqual(self.new_data.web_pass, "madashmartin") def test_add_password(self): ''' Testing if the new website and password can be saved ''' self.new_data.add_password() self.assertEqual(len(UsersInfo.data_list), 1) def test_display_data(self): ''' Testing if the data can be displayed. ''' self.new_data.add_password() test_data = UsersInfo(1, 1, "gmail.com", "madashmartin") test_data.add_password() data_found = UsersInfo.display_data(1, 1) self.assertEqual(data_found.website, test_data.website) def test_data_exists(self): ''' Testing to check if the function for checking data works well ''' self.new_data.add_password() test_data = UsersInfo(1, 1, "gmail.com", "madashmartin") test_data.add_password() data_exists = UsersInfo.existing_data(1) self.assertTrue(data_exists) def test_copy_password(self): ''' Testing if the copy password function works ''' self.new_data.add_password() UsersInfo.copy_password(1, 1)
def setUp(self): ''' Setting up the structure before each test ''' self.new_data = UsersInfo(1, 1, "gmail.com", "kiriu")
def copy_password(number, count): ''' Function that copies the password to the clipboard ''' UsersInfo.copy_password(number, count)
def data_existing(data): ''' Function that checks if user data exists ''' return UsersInfo.existing_data(data)
def display_data(data, number): ''' Function that displays the user data ''' return UsersInfo.display_data(data, number)
def my_new_data(user_id, data_id, website, web_pass): ''' Function that creates new data for storing password ''' new_data = UsersInfo(user_id, data_id, website, web_pass) return new_data
def test_copy_password(self): ''' Testing if the copy password function works ''' self.new_data.add_password() UsersInfo.copy_password(1, 1)