예제 #1
0
    def test_search(self, search_dao):
        search_result = search_dao.return_value = Mock(SearchResult)

        result = extension_services.search(search='term', order='exten',
                                           direction='desc', skip=1,
                                           limit=2)

        search_dao.assert_called_once_with(search='term', order='exten',
                                           direction='desc', skip=1,
                                           limit=2)
        assert_that(result, equal_to(search_result))
예제 #2
0
    def test_search(self, search_dao):
        search_result = search_dao.return_value = Mock(SearchResult)

        result = extension_services.search(search='term', order='exten',
                                           direction='desc', skip=1,
                                           limit=2)

        search_dao.assert_called_once_with(search='term', order='exten',
                                           direction='desc', skip=1,
                                           limit=2)
        assert_that(result, equal_to(search_result))
예제 #3
0
def list():
    parameters = extract_search_parameters(request.args, extra_parameters)
    search_result = extension_services.search(**parameters)
    result = formatter.list_to_api(search_result.items, search_result.total)
    return make_response(result, 200)