コード例 #1
0
class TestUserData(unittest.TestCase):
    '''
    '''
    def setUp(self):
        '''
        set up structure before every test
        '''
        self.new_user_data = UserData("facebook", "maggiebae", "*****@*****.**",
                                      "pass")

    def tearDown(self):
        '''
        clean up after running each test
        '''
        UserData.user_data_list = []

    def test_init(self):
        '''
        Test for test case initialization"
        '''
        self.assertEqual(self.new_user_data.account_name, "facebook")
        self.assertEqual(self.new_user_data.account_username, "maggiebae")
        self.assertEqual(self.new_user_data.account_password, "pass")

    def test_add_password(self):
        '''
        Testing if the new website and password can be saved
        '''
        self.new_user_data.create_password()
        self.assertEqual(len(UserData.user_data_list), 1)
コード例 #2
0
    def test_copy_password(self):
        '''
        Testing if the copy password function works
        '''
        self.new_data.add_password()
        UserData.copy_password(1, 1)

        self.assertEqual(self.new_data.user_key, pyperclip.paste())
コード例 #3
0
    def test_data_exists(self):
        '''
        Testing to check if the data functions works well
        '''
        self.new_data.add_password()
        test_data = UserData(1, 1, "", "", "")
        test_data.add_password()

        data_exists = UserData.existing_data(1)
        self.assertTrue(data_exists)
コード例 #4
0
    def test_display_data(self):
        '''
        Testing if the data can be displayed.
        '''
        self.new_data.add_password()
        test_data = UserData(1, 1, "", "", "")
        test_data.add_password()

        data_found = UserData.display_data(1, 1)
        self.assertEqual(data_found.website, test_data.website)
コード例 #5
0
 def setUp(self):
     '''
     set up structure before every test
     '''
     self.new_user_data = UserData("facebook", "maggiebae", "*****@*****.**",
                                   "pass")
コード例 #6
0
ファイル: run.py プロジェクト: mag49/Password-Locker
def information_exist(account_name):
    '''
    Function to check if the information exists
    '''
    return UserData.information_exists(account_name)
コード例 #7
0
ファイル: run.py プロジェクト: mag49/Password-Locker
def display_data():
    '''
    function to display the user information
    '''
    return UserData.show_user_data()
コード例 #8
0
ファイル: run.py プロジェクト: mag49/Password-Locker
def user_data(account_name,account_user_name, account_email, account_password):
    '''
    Function to authenticate and log in a user
    '''
    information = UserData(account_name, account_user_name, account_email, account_password)
    return data 
コード例 #9
0
 def setUp(self):
     '''
     Setting up the structure before each test
     '''
     self.new_data = UserData(1, 1, "", "", "")
コード例 #10
0
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 = UserData(1, 1, "", "", "")

    def tearDown(self):
        '''
        Cleans up the test after test is complete
        '''
        UserData.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.data_id, 1)
        self.assertEqual(self.new_data.website, "")
        self.assertEqual(self.new_data.web_key, "")
        self.assertEqual(self.new_data.name, "")

    def test_add_password(self):
        '''
        Testing if the new website and password can be saved
        '''
        self.new_data.add_password()
        self.assertEqual(len(UserData.data_list), 1)

    def test_display_data(self):
        '''
        Testing if the data can be displayed.
        '''
        self.new_data.add_password()
        test_data = UserData(1, 1, "", "", "")
        test_data.add_password()

        data_found = UserData.display_data(1, 1)
        self.assertEqual(data_found.website, test_data.website)

    def test_data_exists(self):
        '''
        Testing to check if the data functions works well
        '''
        self.new_data.add_password()
        test_data = UserData(1, 1, "", "", "")
        test_data.add_password()

        data_exists = UserData.existing_data(1)
        self.assertTrue(data_exists)

    def test_copy_password(self):
        '''
        Testing if the copy password function works
        '''
        self.new_data.add_password()
        UserData.copy_password(1, 1)

        self.assertEqual(self.new_data.user_key, pyperclip.paste())