Beispiel #1
0
    def test_search_results_handles_zero_results(self):
        self.fixture['documents'] = []
        self.fixture['meta']['total'] = 0

        search_results_instance = SearchResults(self.fixture,
                                                self._lots_by_slug)
        assert search_results_instance.search_results == []
        assert search_results_instance.total == 0
Beispiel #2
0
 def test_no_highlighting_if_no_fields_specified(self):
     search_results_instance = SearchResults(
         self.fixture,
         self._lots_by_slug,
     )
     result_with_no_highlight = self._get_service_result_by_id(
         search_results_instance.search_results, '4-G4-0871-001')
     assert result_with_no_highlight['serviceSummary'].startswith(
         u"Fastly CDN (Content Delivery Network) speeds up delivery of your website and its content to your users"
     )
Beispiel #3
0
 def test_highlighting_for_one_line_summary(self):
     search_results_instance = SearchResults(
         self.fixture,
         self._lots_by_slug,
         highlight_fields=frozenset(("serviceSummary", )),
     )
     result_with_one_line_highlight = self._get_service_result_by_id(
         search_results_instance.search_results, '4-G4-0871-001')
     assert result_with_one_line_highlight['serviceSummary'] == Markup(
         u"Fastly <em>CDN</em> (Content Delivery Network) speeds up delivery of your website and its content to your"
     )
Beispiel #4
0
    def setup_method(self, method):
        super().setup_method(method)

        self._lots_by_slug = framework_helpers.get_lots_by_slug(
            self._get_framework_fixture_data('g-cloud-6')['frameworks'])

        self._g9_lots_by_slug = framework_helpers.get_lots_by_slug(
            self._get_framework_fixture_data('g-cloud-9')['frameworks'])

        self.fixture = _get_fixture_data()
        self.search_results = SearchResults(self.fixture, self._lots_by_slug)
        self.request_args = MultiDict((
            ('lot', 'saas'),
            ('q', 'email'),
        ))
Beispiel #5
0
 def test_highlighting_for_multiple_line_summary(self):
     search_results_instance = SearchResults(
         self.fixture,
         self._lots_by_slug,
         highlight_fields=frozenset((
             "serviceSummary",
             "serviceDescription",
         )),
     )
     result_with_multi_line_highlight = self._get_service_result_by_id(
         search_results_instance.search_results, '4-G1-0340-001')
     assert result_with_multi_line_highlight['serviceSummary'] == Markup(
         u" Baycloud Systems or in a suitable Content Delivery"
         u" Network (<em>CDN</em>) such as the Windows Azure" +
         u" <em>CDN</em>. The <em>CDN</em> improves performance" +
         u" by caching content at locations closest to visitors" +
         u" to customer\u2019s websites. The Windows Azure" +
         u" <em>CDN</em> is a managed service that is operated by" +
         u" Microsoft and has a 99.99% monthly")
Beispiel #6
0
 def test_search_results_page_is_set(self):
     search_results_instance = SearchResults(self.multiple_pages_fixture,
                                             self._lots_by_slug)
     assert hasattr(search_results_instance, 'page')
     assert search_results_instance.page == "20"
Beispiel #7
0
 def test_search_results_page_is_not_set(self):
     search_results_instance = SearchResults(self.fixture,
                                             self._lots_by_slug)
     assert not hasattr(search_results_instance, 'page')
Beispiel #8
0
 def test_search_results_total_is_set(self):
     search_results_instance = SearchResults(self.fixture,
                                             self._lots_by_slug)
     assert hasattr(search_results_instance, 'total')
     assert search_results_instance.total == 9
Beispiel #9
0
 def test_search_results_is_set(self):
     search_results_instance = SearchResults(self.fixture,
                                             self._lots_by_slug)
     assert hasattr(search_results_instance, 'search_results')
Beispiel #10
0
 def test_highlighting_only_happens_on_service_summaries(self):
     search_results_instance = SearchResults(self.fixture,
                                             self._lots_by_slug)
     result_with_service_name_highlight = self._get_service_result_by_id(
         search_results_instance.search_results, '5-G3-0279-010')
     assert result_with_service_name_highlight['serviceName'] == "CDN VDMS"