MCPcopy
hub / github.com/django/django / test_check_finders

Method test_check_finders

tests/staticfiles_tests/test_checks.py:26–52  ·  view source on GitHub ↗

check_finders() concatenates all errors.

(self)

Source from the content-addressed store, hash-verified

24 finder.check()
25
26 def test_check_finders(self):
27 """check_finders() concatenates all errors."""
28 error1 = Error("1")
29 error2 = Error("2")
30 error3 = Error("3")
31
32 def get_finders():
33 class Finder1(BaseFinder):
34 def check(self, **kwargs):
35 return [error1]
36
37 class Finder2(BaseFinder):
38 def check(self, **kwargs):
39 return []
40
41 class Finder3(BaseFinder):
42 def check(self, **kwargs):
43 return [error2, error3]
44
45 class Finder4(BaseFinder):
46 pass
47
48 return [Finder1(), Finder2(), Finder3(), Finder4()]
49
50 with mock.patch("django.contrib.staticfiles.checks.get_finders", get_finders):
51 errors = check_finders(None)
52 self.assertEqual(errors, [error1, error2, error3])
53
54 def test_no_errors_with_test_settings(self):
55 self.assertEqual(check_finders(None), [])

Callers

nothing calls this directly

Calls 3

ErrorClass · 0.90
check_findersFunction · 0.90
patchMethod · 0.45

Tested by

no test coverage detected