def test_save_multiple_users(self): ''' test_save_multiple_user to check if we can save multiple user objects to our user_list ''' self.new_user.save_user() test_user = user("john", "4321") # new user test_user.save_user() self.assertEqual(len(user.user_list), 2)
def test_find_user_by_name(self): ''' test to check if we can find an user by name ''' self.new_user.save_user() test_user = user("james", "3425") # new user test_user.save_user() found_user = user.find_by_name("james") self.assertEqual(found_user.user_name, test_user.user_name)
def test_user_exists(self): ''' test to check if we can return a Boolean if we cannot find the user. ''' self.new_user.save_user() test_user = user( "Test", "3344", ) # new user test_user.save_user() user_exists = user.user_exist("Test", "3344") self.assertTrue(user_exists)
def create_user(user_name, password): ''' Function to create a new userimport random ''' new_user = user(user_name, password) return new_user
def setUp(self): ''' Set up method to run before each test cases. ''' self.new_user = user("James", "1234") # create user object