diff --git a/manifest/tests/test_utils.py b/manifest/tests/test_utils.py new file mode 100644 index 0000000..aa51292 --- /dev/null +++ b/manifest/tests/test_utils.py @@ -0,0 +1,26 @@ +import pytest + +from ..utils import is_blacklisted + + +@pytest.mark.parametrize("url", [ + "/foo", + "/tools/foo", + "/resources/foo", + "/common/foo", + "/conformance-checkers/foo", + "/_certs/foo" +]) +def test_is_blacklisted(url): + assert is_blacklisted(url) is True + + +@pytest.mark.parametrize("url", [ + "/foo/tools/bar", + "/foo/resources/bar", + "/foo/common/bar", + "/foo/conformance-checkers/bar", + "/foo/_certs/bar" +]) +def test_not_is_blacklisted(url): + assert is_blacklisted(url) is False diff --git a/manifest/utils.py b/manifest/utils.py index a96ba59..9fd3b3b 100644 --- a/manifest/utils.py +++ b/manifest/utils.py @@ -1,7 +1,7 @@ import os from six import BytesIO -blacklist = ["/tools/", "/resources/", "/common/", "/conformance-checkers/", "_certs"] +blacklist = ["/tools/", "/resources/", "/common/", "/conformance-checkers/", "/_certs/"] def rel_path_to_url(rel_path, url_base="/"): assert not os.path.isabs(rel_path)