Exemplo n.º 1
0
    def setUp(self):
        super(ModelSearchFormTestCase, self).setUp()
        mock_index_site = SearchSite()
        mock_index_site.register(MockModel)
        mock_index_site.register(AnotherMockModel)

        # Stow.
        self.old_site = haystack.site
        haystack.site = mock_index_site

        self.sqs = SearchQuerySet(
            query=DummySearchQuery(backend=DummySearchBackend()),
            site=mock_index_site)
Exemplo n.º 2
0
 def setUp(self):
     super(PickleSearchQuerySetTestCase, self).setUp()
     self.bsqs = SearchQuerySet(query=DummySearchQuery(backend=DummySearchBackend()))
     self.msqs = SearchQuerySet(query=MockSearchQuery(backend=MockSearchBackend()))
     self.mmsqs = SearchQuerySet(query=MockSearchQuery(backend=MixedMockSearchBackend()))
     
     # Stow.
     self.old_debug = settings.DEBUG
     settings.DEBUG = True
     self.old_site = haystack.site
     test_site = SearchSite()
     test_site.register(MockModel)
     test_site.register(CharPKMockModel)
     haystack.site = test_site
     
     backends.reset_search_queries()
Exemplo n.º 3
0
 def setUp(self):
     super(BaseSearchQueryTestCase, self).setUp()
     self.bsq = BaseSearchQuery(backend=DummySearchBackend())
Exemplo n.º 4
0
 def test_regression_dummy_unicode(self):
     dsq = DummySearchQuery(backend=DummySearchBackend())
     self.assertEqual(dsq.build_query_fragment('foo', 'exact', 'bar'), 'foo__exact bar')
     self.assertEqual(dsq.build_query_fragment('foo', 'exact', u'☃'), u'foo__exact ☃')