def test_markup_method_works_with_no_fragments(self): def get_starting_sentence(): return u"5 results found" search_summary = SearchSummary(9, self.request_args, filter_groups, self._lots_by_slug) search_summary.get_starting_sentence = get_starting_sentence search_summary.filters_fragments = [] assert search_summary.markup() == u"5 results found"
def test_markup_method_works_with_wrap(self): def get_starting_sentence(): return u"5 results found" search_summary = SearchSummary(9, self.request_args, filter_groups, self._lots_by_slug) search_summary.get_starting_sentence = get_starting_sentence search_summary.filters_fragments = [] wrapped_summary_markup = search_summary.markup(True) assert wrapped_summary_markup == u'<p class="app-search-summary govuk-body-s">5 results found</p>'
def test_markup_method_works_with_fragments(self): def get_starting_sentence(): return u"5 results found" fragment = Mock(**{"str.return_value": u"with option1 and option2"}) search_summary = SearchSummary(9, self.request_args, filter_groups, self._lots_by_slug) search_summary.get_starting_sentence = get_starting_sentence search_summary.filters_fragments = [fragment] assert search_summary.markup( ) == u"5 results found with option1 and option2"
def test_get_starting_sentence_works(self): search_summary = SearchSummary('9', self.request_args, filter_groups, self._lots_by_slug) search_summary.count = '9' search_summary.COUNT_PRE_TAG = '<strong>' search_summary.COUNT_POST_TAG = '</strong>' search_summary.sentence = ( u"results found containing <strong>email</strong>" + u" in <strong>Software as a Service</strong>") assert search_summary.get_starting_sentence() == ( u"<strong>9</strong> results found containing " "<strong>email</strong> in <strong>Software as a Service</strong>")