MCPcopy Create free account
hub / github.com/django-haystack/django-haystack / setUp

Method setUp

test_haystack/test_models.py:26–47  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24 fixtures = ["base_data"]
25
26 def setUp(self):
27 super().setUp()
28 cap = CaptureHandler()
29 logging.getLogger("haystack").addHandler(cap)
30
31 self.no_data = {}
32 self.extra_data = {"stored": "I am stored data. How fun."}
33 self.no_overwrite_data = {
34 "django_id": 2,
35 "django_ct": "haystack.anothermockmodel",
36 "stored": "I am stored data. How fun.",
37 }
38
39 # The str(1) bit might seem unnecessary but it avoids test_unicode needing to handle
40 # the differences between repr() output on Python 2 and 3 for a unicode literal:
41 self.no_data_sr = MockSearchResult("haystack", "mockmodel", str(1), 2)
42 self.extra_data_sr = MockSearchResult(
43 "haystack", "mockmodel", str(1), 3, **self.extra_data
44 )
45 self.no_overwrite_data_sr = MockSearchResult(
46 "haystack", "mockmodel", str(1), 4, **self.no_overwrite_data
47 )
48
49 def test_init(self):
50 self.assertEqual(self.no_data_sr.app_label, "haystack")

Callers

nothing calls this directly

Calls 2

MockSearchResultClass · 0.85
CaptureHandlerClass · 0.70

Tested by

no test coverage detected