Пример #1
0
 def test_save_multiple_users(self):
     '''
     to check if we can save multiple users
     '''
     self.new_user.save_user()
     test_user = User("Test","name")
     test_user.save_user()
     self.assertEqual(len(User.user_list),2)
Пример #2
0
    def test_delete_user(self):
        '''
        test for deleting users
        '''
        self.new_user.save_user()
        test_user = User("Test","name")
        test_user.save_user()

        self.new_user.delete_user()
        self.assertEqual(len(User.user_list),1)
Пример #3
0
class TestPassword(unittest.TestCase):

    '''
    test class that define taste cases for the password class
    '''

    def setUp(self):
        '''
        method to run before each test cases
        '''
        self.new_user = User("Kevin","password")

    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run.
        '''
        User.user_list = []

    def test_init(self):
        '''
        test case to test if the object is initialized properly
        '''

        self.assertEqual(self.new_user.name,"Kevin")
        self.assertEqual(self.new_user.password,"password")


    def test_save_user(self):
        '''
        testing the save_user method
        '''
        self.new_user.save_user()
        self.assertEqual(len(User.user_list),1)


    def test_display_details(self):
        '''
        tests for display_details method
        '''
        self.assertEqual(User.display_details(),User.user_list)



    def test_delete_user(self):
        '''
        test for deleting users
        '''
        self.new_user.save_user()
        test_user = User("Test","name")
        test_user.save_user()

        self.new_user.delete_user()
        self.assertEqual(len(User.user_list),1)


    def test_save_multiple_users(self):
        '''
        to check if we can save multiple users
        '''
        self.new_user.save_user()
        test_user = User("Test","name")
        test_user.save_user()
        self.assertEqual(len(User.user_list),2)
Пример #4
0
 def test_display_details(self):
     '''
     tests for display_details method
     '''
     self.assertEqual(User.display_details(),User.user_list)
Пример #5
0
 def setUp(self):
     '''
     method to run before each test cases
     '''
     self.new_user = User("Kevin","password")
Пример #6
0
def create_user(name, password):
    new_user = User(name, password)
    return new_user
Пример #7
0
def find_user(number):
    return User.find_by_number(number)
Пример #8
0
def display_details():
    return User.display_details()