Exemplo n.º 1
0
def test_yarn_allow_files(settings):
    systematize = 'systematize/build/systematize.css'
    syspath = settings.DJANGO_ROOT / 'node_modules' / systematize
    assert isfile(syspath)
    assert isfile(syspath.with_suffix('.min.css'))

    clean_yarn_settings(settings)
    settings.YARN_ALLOW_FILES = None
    settings.YARN_ROOT_PATH = settings.DJANGO_ROOT.as_posix()
    settings.YARN_STATIC_FILES_PREFIX = 'yarn-testing'

    findpath = joinpath('yarn-testing', systematize)
    finder = YarnFinder()
    assert not finder.find(findpath)
    assert not list(finder.list(None))

    settings.YARN_ALLOW_FILES = [systematize]

    finder = YarnFinder()
    assert syspath.samefile(finder.find(findpath))
    # PurePath is needed because Windows
    assert [PurePath(a)
            for a, b in finder.list(None)] == [PurePath(systematize)]

    settings.YARN_ALLOW_FILES = ['systematize/build/*.css']

    finder = YarnFinder()
    assert count(finder.list(None)) == 2
Exemplo n.º 2
0
def test_finder_no_cache(yarn_dir):
    with override_settings(YARN_FINDER_USE_CACHE=False):
        f = YarnFinder()
        f.list()
        assert f.cached_list is None
        assert f.list() is not f.cached_list
Exemplo n.º 3
0
def test_finder_list_all(yarn_dir):
    f = YarnFinder()
    assert any([True for _ in f.list()])