Esempio n. 1
0
 def test_save_multiple_user(self):
     
     #Test to check whether we can save multiple user objects.
     
     self.new_user.user_save()
     test_user = User("mami","716491250","*****@*****.**")
     test_user.user_save()
     self.assertEqual(len(User.user_list),2) 
Esempio n. 2
0
 def test_save_multiple_user(self):
     """
     Test to check whether we can save multiple user objects.
     """
     self.new_user.user_save()
     test_user = User("puppah", "78945632", "*****@*****.**")
     test_user.user_save()
     self.assertEqual(len(User.user_list), 2)
Esempio n. 3
0
class TestUser(unittest.TestCase):

    #Test that defines test cases for the user class bevaviours
    
    def setUp(self):
        
        #set up method to run before each test cases
        
        self.new_user = User("kim", "5991", "*****@*****.**")
    def test_init(self):
        
        #Test case to test if the object is initialized properly
        
        self.assertEqual(self.new_user.user_name,"kim")
        self.assertEqual(self.new_user.password, "5991")
        self.assertEqual(self.new_user.email, "*****@*****.**")


    def tearDown(self):
        
        #Method that cleans up after each case has run.
        
        User.user_list = []

    def test_user_save(self):
        
        #Test case to test if the user object is saved into the user_list.
        
        self.new_user.user_save()
    
        self.assertEqual(len(User.user_list),1)

    def test_save_multiple_user(self):
        
        #Test to check whether we can save multiple user objects.
        
        self.new_user.user_save()
        test_user = User("mami","716491250","*****@*****.**")
        test_user.user_save()
        self.assertEqual(len(User.user_list),2) 

    def test_display_users(self):
        self.assertEqual(User.display_users(),User.user_list)
Esempio n. 4
0
class TestUser(unittest.TestCase):
    """
    Test that defines test cases for the user class bevaviours
    """
    def setUp(self):
        """
        set up method to run before each test cases
        """
        self.new_user = User("jgovish", "12345", "*****@*****.**")

    def test_init(self):
        """
        Test case to test if the object is initialized properly
        """
        self.assertEqual(self.new_user.user_name, "jgovish")
        self.assertEqual(self.new_user.password, "12345")
        self.assertEqual(self.new_user.email, "*****@*****.**")

    def tearDown(self):
        """
        Method that cleans up after each case has run.
        """
        User.user_list = []

    def test_user_save(self):
        """
        Test case to test if the user object is saved into the user_list.
        """
        self.new_user.user_save()

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

    def test_save_multiple_user(self):
        """
        Test to check whether we can save multiple user objects.
        """
        self.new_user.user_save()
        test_user = User("puppah", "78945632", "*****@*****.**")
        test_user.user_save()
        self.assertEqual(len(User.user_list), 2)

    def test_display_users(self):
        self.assertEqual(User.display_users(), User.user_list)