def test_returns_when_invalid_and_not_strict(self): cb = ManifestCacheBuster("warehouse:static/dist/manifest.json", strict=False) cb._manifest = {} result = cb(None, "/the/path/style.css", {"keyword": "arg"}) assert result == ("/the/path/style.css", {"keyword": "arg"})
def test_returns_when_invalid_and_not_strict(self): cb = ManifestCacheBuster( "warehouse:static/dist/manifest.json", strict=False, ) cb._manifest = {} result = cb(None, "/the/path/style.css", {"keyword": "arg"}) assert result == ("/the/path/style.css", {"keyword": "arg"})
def test_raises_when_invalid(self): cb = ManifestCacheBuster("warehouse:static/dist/manifest.json") cb._manifest = {} with pytest.raises(ValueError): cb(None, "/the/path/style.css", {"keyword": "arg"})
def test_returns_when_valid(self): cb = ManifestCacheBuster("warehouse:static/dist/manifest.json") cb._manifest = {"/the/path/style.css": "/the/busted/path/style.css"} result = cb(None, "/the/path/style.css", {"keyword": "arg"}) assert result == ("/the/busted/path/style.css", {"keyword": "arg"})