Ejemplo n.º 1
0
class TestClass(unittest.TestCase):
    """
    A Test class that defines test cases for the User class.
    """
    def setUp(self):
        """
        Method that runs before each individual test methods run.
        """
        self.new_user = User('MarthaValary', 'Sorabtra1234')

    def test_init(self):
        """
        test case to chek if the object has been initialized correctly
        """
        self.assertEqual(self.new_user.username, 'MarthaValary')
        self.assertEqual(self.new_user.username, 'MarthaValary')
        self.assertEqual(self.new_user.password, 'Sorabtra1234')

    def test_save_user(self):
        """
        test case to test if a new user instance has been saved into the User list

        """
        self.new_user.save_user()
        self.assertEqual(len(User.user_list), 1)
Ejemplo n.º 2
0
class TestClass(unittest.TestCase):

    def setUp(self):
        self.new_user = User('Tonyishangu','XyZ3thf1')

    def test_init(self):
        self.assertEqual(self.new_user.username,'Tonyishangu')
        self.assertEqual(self.new_user.password,'XyZ3thf1')

    def test_save_user(self):
        self.new_user.save_user()
        self.assertEqual(len(User.user_list),1)
Ejemplo n.º 3
0
class TestClass(unittest.TestCase):
    def setUp(self):
        """
        a method that runs before the test
        """
        self.new_user = User("lekamcharity", "kulangombe")

    def test_init(self):
        """
        test case to check if the object in initialized correctly
        """
        self.assertEqual(self.new_user.username, 'lekamcharity')
        self.assertEqual(self.new_user.password, 'kulangombe')

    def test_save_user(self):
        '''
        test case to check if the new instance of the user object has neen created
        '''

        self.new_user.save_user()
        self.assertEqual(len(User.user_list), 1)
Ejemplo n.º 4
0
class TestClass(unittest.TestCase):
    def setUp(self):
        """
        a method that runs before the test
        """
        self.new_user = User("AlbertByrone", "qwertykey")

    def test_init(self):
        """
        test case to check if the object in initialized correctly
        """
        self.assertEqual(self.new_user.username, 'AlbertByrone')
        self.assertEqual(self.new_user.password, 'qwertykey')

    def test_save_user(self):
        '''
        test case to check if the new instance of the user object has neen created
        '''

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