Пример #1
0
    def test_find_all_order_by_lastname(self):
        user_last = self.add_user(firstname='Albert', lastname='Breton')
        user_first = self.add_user(firstname='Bob', lastname='Alzard')

        users = user_dao.find_all(order=['lastname'])

        assert_that(users[0].id, equal_to(user_first.id))
        assert_that(users[1].id, equal_to(user_last.id))
Пример #2
0
    def test_find_all_order_by_lastname(self):
        user_last = self.add_user(firstname='Albert', lastname='Breton')
        user_first = self.add_user(firstname='Bob', lastname='Alzard')

        users = user_dao.find_all(order=['lastname'])

        assert_that(users[0].id, equal_to(user_first.id))
        assert_that(users[1].id, equal_to(user_last.id))
Пример #3
0
    def test_find_all_one_user_commented(self):
        firstname = 'Pascal'
        user = self.add_user(firstname=firstname, commented=1)

        users = user_dao.find_all()
        assert_that(users, has_length(1))

        user_found = users[0]
        assert_that(user_found, has_property('id', user.id))
        assert_that(user_found, has_property('firstname', firstname))
Пример #4
0
    def test_find_all_one_user_commented(self):
        firstname = 'Pascal'
        user = self.add_user(firstname=firstname, commented=1)

        users = user_dao.find_all()
        assert_that(users, has_length(1))

        user_found = users[0]
        assert_that(user_found, has_property('id', user.id))
        assert_that(user_found, has_property('firstname', firstname))
Пример #5
0
    def test_find_all_default_order_by_lastname_firstname(self):
        user1 = self.add_user(firstname='Jules', lastname='Santerre')
        user2 = self.add_user(firstname='Vicky', lastname='Bourbon')
        user3 = self.add_user(firstname='Anne', lastname='Bourbon')

        users = user_dao.find_all()
        assert_that(users, has_length(3))

        assert_that(users[0].id, equal_to(user3.id))
        assert_that(users[1].id, equal_to(user2.id))
        assert_that(users[2].id, equal_to(user1.id))
Пример #6
0
    def test_find_all_default_order_by_lastname_firstname(self):
        user1 = self.add_user(firstname='Jules', lastname='Santerre')
        user2 = self.add_user(firstname='Vicky', lastname='Bourbon')
        user3 = self.add_user(firstname='Anne', lastname='Bourbon')

        users = user_dao.find_all()
        assert_that(users, has_length(3))

        assert_that(users[0].id, equal_to(user3.id))
        assert_that(users[1].id, equal_to(user2.id))
        assert_that(users[2].id, equal_to(user1.id))
Пример #7
0
    def test_find_all_two_users(self):
        firstname1 = 'Pascal'
        firstname2 = 'George'

        user1 = self.add_user(firstname=firstname1)
        user2 = self.add_user(firstname=firstname2)

        users = user_dao.find_all()
        assert_that(users, has_length(2))

        assert_that(
            users,
            has_items(
                all_of(has_property('id', user1.id),
                       has_property('firstname', firstname1)),
                all_of(has_property('id', user2.id),
                       has_property('firstname', firstname2))))
Пример #8
0
    def test_find_all_two_users(self):
        firstname1 = 'Pascal'
        firstname2 = 'George'

        user1 = self.add_user(firstname=firstname1)
        user2 = self.add_user(firstname=firstname2)

        users = user_dao.find_all()
        assert_that(users, has_length(2))

        assert_that(users, has_items(
            all_of(
                has_property('id', user1.id),
                has_property('firstname', firstname1)),
            all_of(
                has_property('id', user2.id),
                has_property('firstname', firstname2))
        ))
Пример #9
0
    def test_find_all_no_users(self):
        expected = []
        users = user_dao.find_all()

        assert_that(users, equal_to(expected))
Пример #10
0
    def test_find_all_no_users(self):
        expected = []
        users = user_dao.find_all()

        assert_that(users, equal_to(expected))
Пример #11
0
def find_all(order=None):
    return user_dao.find_all(order=order)