def test_find_user_not_right_firstname(self): firstname = 'Lord' lastname = 'Sanderson' wrong_firstname = 'Gregory' self.add_user(firstname=firstname, lastname=lastname) result = user_dao.find_user(wrong_firstname, lastname) assert_that(result, equal_to(None))
def test_find_user_two_users_same_name(self): firstname = 'Lord' lastname = 'Sanderson' user1 = self.add_user(firstname=firstname, lastname=lastname) user2 = self.add_user(firstname=firstname, lastname=lastname) result = user_dao.find_user(firstname, lastname) assert_that(result, has_property('id', any_of(user1.id, user2.id)))
def test_find_user(self): firstname = 'Lord' lastname = 'Sanderson' user = self.add_user(firstname=firstname, lastname=lastname) result = user_dao.find_user('Lord', 'Sanderson') assert_that( result, all_of(has_property('id', user.id), has_property('firstname', firstname), has_property('lastname', lastname)))
def test_find_user(self): firstname = 'Lord' lastname = 'Sanderson' user = self.add_user(firstname=firstname, lastname=lastname) result = user_dao.find_user('Lord', 'Sanderson') assert_that(result, all_of( has_property('id', user.id), has_property('firstname', firstname), has_property('lastname', lastname) ))
def test_find_user_no_user(self): result = user_dao.find_user('abc', 'def') assert_that(result, equal_to(None))
def find_user_by_name(name): firstname, lastname = name.split(" ") return user_dao.find_user(firstname, lastname)
def find_by_firstname_lastname(firstname, lastname): return user_dao.find_user(firstname, lastname)