コード例 #1
0
    def test_check_user(self):
        '''
        function to test whether the log in function check_user work as expected
        '''
        self.new_user = User("Kernael", "Apuko", "oketch92")
        self.new_user.save_user()
        user2 = User("Mary", "Jane", "maryja01")
        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, (user2.password, user2.first_name))
コード例 #2
0
 def test_save_multiple_user(self):
     '''
     test_save_multiple_user to check if we can save multiple user objects to the users list
     '''
     self.new_user.save_user()
     test_user = User("Test", "User", "usert001")  #new user
     test_user.save_user()
     self.assertEqual(len(User.users_list), 2)
コード例 #3
0
    def test_verify_user(self):
        '''
        Test for the verify_user() function
        '''
        self.new_user = User('Mag', 'Um', 'SGhhn20m')
        self.new_user.save_user()
        user1 = User('Mwiin', 'sick', 'SGhhn20m')
        user1.save_user()
        logged_in_user = ''

        for user in User.users_list:
            if user.fname == user1.fname and user.pword == user.pword:
                logged_in_user = user.fname
            return logged_in_user

            self.assertEqual(logged_in_user,
                             Credential.verify_user(user1.pword, user1.fname))
コード例 #4
0
    def test_save_user(self):
        '''
        test_save_user test case to test if the user object is saved into
         the user list
        '''
        self.new_user = User('Mag', 'Um', 'SGhhn20m')

        self.new_user.save_user()
        self.assertEqual(len(User.users_list), 1)
コード例 #5
0
    def test__init__(self):
        '''
        Test to see if the initialisation works.
        '''
        self.new_user = User('Mag', 'Um', 'SGhhn20m')

        self.assertEqual(self.new_user.fname, 'Mag')
        self.assertEqual(self.new_user.lname, 'Um')
        self.assertEqual(self.new_user.pword, 'SGhhn20m')
コード例 #6
0
 def setUp(self):
     self.new_user = User('Aoko','Mercy2x0')
コード例 #7
0
ファイル: run.py プロジェクト: AokoMercyline/Password-Locker
def create_user(username, password):
    new_user = User(username, password)
    return new_user
コード例 #8
0
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     self.new_user = User("Kernael", "Apuko",
                          "oketch92")  #create user object
コード例 #9
0
ファイル: run.py プロジェクト: Magnific7/Password_locker
def create_user(fname, lname, pword):
    '''
    Function to create a new user
    '''
    new_user = User(fname, lname, pword)
    return new_user
コード例 #10
0
 def setUP(self):
     '''
     Function to create user account.
     '''
     self.new_user = User('Mag', 'Um', 'SGhhn20m')
コード例 #11
0
 def setUp(self):
     """
     Method that runs before each individual test methods run.
     """
     self.new_user = User('Abzed','Abzed1z0')
コード例 #12
0
ファイル: run.py プロジェクト: Abzed/password_locker
def create_user(username, password):
    '''
    Function to create a new user with a username and password
    '''
    new_user = User(username, password)
    return new_user