diff --git a/manifest/tests/test_utils.py b/manifest/tests/test_utils.py new file mode 100644 index 00000000000000..aa51292a31edc5 --- /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 a96ba59802fbc7..9fd3b3bdcd9bd3 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)