Python django.contrib.staticfiles.finders.BaseFinder() Examples

The following are 2 code examples of django.contrib.staticfiles.finders.BaseFinder(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.contrib.staticfiles.finders , or try the search function .
Example #1
Source File: test_checks.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_base_finder_check_not_implemented(self):
        finder = BaseFinder()
        msg = 'subclasses may provide a check() method to verify the finder is configured correctly.'
        with self.assertRaisesMessage(NotImplementedError, msg):
            finder.check() 
Example #2
Source File: test_checks.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_check_finders(self):
        """check_finders() concatenates all errors."""
        error1 = Error('1')
        error2 = Error('2')
        error3 = Error('3')

        def get_finders():
            class Finder1(BaseFinder):
                def check(self, **kwargs):
                    return [error1]

            class Finder2(BaseFinder):
                def check(self, **kwargs):
                    return []

            class Finder3(BaseFinder):
                def check(self, **kwargs):
                    return [error2, error3]

            class Finder4(BaseFinder):
                pass

            return [Finder1(), Finder2(), Finder3(), Finder4()]

        with mock.patch('django.contrib.staticfiles.checks.get_finders', get_finders):
            errors = check_finders(None)
            self.assertEqual(errors, [error1, error2, error3])