def test_account_exist(self):
        '''
        method to check whether the account details of the User exist
        '''
        self.new_user.save_user_info()
        test_user = User("Twitter", "Diane", "dee420")
        test_user.save_user_info()

        user_exists = User.account_exists("Twitter")
        self.assertTrue(user_exists)
    def test_find_by_account_name(self):
        '''
        Test case to test whether a user can find their account by account_name
        '''
        self.new_user.save_user_info()
        test_user = User("Twitter", "Diane", "dee420")
        test_user.save_user_info()

        user_found = User.find_by_account_name("Twitter")
        self.assertEqual(user_found.username, test_user.username)
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the User class behaviours
    '''
    def setUp(self):
        '''
        This method runs each time before every test case.
        '''

        self.new_user = User("Slack", "Ayebale Nelly Abigail", "password123")

    def tearDown(self):
        '''
        This method runs each time after every test case.
        '''
        User.user_list = []

    def test_init(self):
        """
        Method to test if the ojects have been initalized properly.
        """
        self.assertEqual(self.new_user.account_name, "Slack")
        self.assertEqual(self.new_user.username, "Ayebale Nelly Abigail")
        self.assertEqual(self.new_user.password, "password123")

    def test_save_user_info(self):
        '''
        Test case to test if accounts are being saved to the userlist.
        '''
        self.new_user.save_user_info()
        self.assertEqual(len(User.user_list), 1)

    def test_find_by_account_name(self):
        '''
        Test case to test whether a user can find their account by account_name
        '''
        self.new_user.save_user_info()
        test_user = User("Twitter", "Diane", "dee420")
        test_user.save_user_info()

        user_found = User.find_by_account_name("Twitter")
        self.assertEqual(user_found.username, test_user.username)

    def test_account_exist(self):
        '''
        method to check whether the account details of the User exist
        '''
        self.new_user.save_user_info()
        test_user = User("Twitter", "Diane", "dee420")
        test_user.save_user_info()

        user_exists = User.account_exists("Twitter")
        self.assertTrue(user_exists)

    def test_display_accounts(self):
        '''
        Test case to test whether the accounts can be displayed
        '''
        self.assertEqual(User.display_accounts(), User.user_list)