Beispiel #1
0
 def test__nave_query_response__serialized(self):
     response = NaveQueryResponse(self.query)
     response._results = self.results
     assert isinstance(response.facets, NaveFacets)
     serializer = NaveQueryResponseSerializer(response)
     print(serializer.data)
     assert 'facets' in serializer.data
     assert 'pagination' in serializer.data
     assert 'query' in serializer.data
Beispiel #2
0
 def test__user_query__serializer(self):
     response = NaveQueryResponse(self.query)
     response._results = self.results
     serializer = UserQuerySerializer(response.user_query)
     assert serializer.data == {'numfound': 73, 'terms': 'best', 'breadCrumbs': [
         {'href': 'q=best&facet=gemeente%2C+plaats', 'display': 'best', 'field': '', 'localised_fied': '',
          'value': 'best', 'is_last': False},
         {'href': 'q=best&facet=gemeente%2C+plaats&qf=gemeente%3ABest', 'display': 'gemeente:Best',
          'field': 'gemeente', 'localised_fied': 'gemeente', 'value': 'Best', 'is_last': True}]}
Beispiel #3
0
 def test__pagination__serialized(self):
     response = NaveQueryResponse(self.query)
     response._results = self.results
     assert isinstance(response.pagination, QueryPagination)
     pagination = response.pagination
     assert pagination.first_page == 1
     assert not pagination.has_previous
     assert pagination.first_page == 1
     assert pagination.last_page == 5
     assert pagination.start == 1
     assert len(pagination.links) == 5
     pagination_ser = QueryPaginationSerializer(pagination).data
     assert list(pagination_ser.keys()) == ['start',
                                      'rows',
                                      'numFound',
                                      'hasNext',
                                      'nextPage',
                                      'nextPageNumber',
                                      'hasPrevious',
                                      'previousPage',
                                      'previousPageNumber',
                                      'firstPage',
                                      'lastPage',
                                      'links']
Beispiel #4
0
 def test__facets__with_filters(self):
     response = NaveQueryResponse(self.query)
     response._results = self.results
     assert isinstance(response.facets, NaveFacets)
     assert len(response.facets.facet_query_list) == 2
Beispiel #5
0
 def test__user_query__with_filters(self):
     response = NaveQueryResponse(self.query)
     response._results = self.results
     assert response.user_query.num_found == 73
     assert response.user_query.terms == 'best'
     assert len(response.user_query._items) == 2