Skip to content
Myr

parametrize some tests (#3786)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Paul Sanders · committed by GitHub · parent bdf7083 · Browse files · 1 file+15 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−15 removed

  • tests:+15 added−15 removed

1 file+15 added−15 removed

modified:tests/test_helpers.py+15 added-15 removed
893 unmodified lines
894 assert rv.data == b"flask"895896897class TestSafeJoin:898 def test_safe_join(self):899 # Valid combinations of *args and expected joined paths.900 passing = (898 @pytest.mark.parametrize(899 "args, expected",900 (901 (("a/b/c",), "a/b/c"),902 (("/", "a/", "b/", "c/"), "/a/b/c"),903 (("a", "b", "c"), "a/b/c"),904 (("/a", "b/c"), "/a/b/c"),
6 unmodified lines
911 (("a/b/c", "X/.."), "a/b/c/."),912 # Base directory is always considered safe913 (("../", "a/b/c"), "../a/b/c"),914 (("/..",), "/.."),915 )915 ),916 )917 def test_safe_join(self, args, expected):918 assert flask.safe_join(*args) == expected919917 for args, expected in passing:918 assert flask.safe_join(*args) == expected919920 def test_safe_join_exceptions(self):921 # Should raise werkzeug.exceptions.NotFound on unsafe joins.922 failing = (920 @pytest.mark.parametrize(921 "args",922 (923 # path.isabs and ``..'' checks924 ("/a", "b", "/c"),925 ("/a", "../b/c"),926 ("/a", "..", "b/c"),927 # Boundaries violations after path normalization928 ("/a", "b/../b/../../c"),929 ("/a", "b", "c/../.."),930 ("/a", "b/../../c"),931 )931 ),932 )933 def test_safe_join_exceptions(self, args):934 with pytest.raises(NotFound):935 print(flask.safe_join(*args))936933 for args in failing:934 with pytest.raises(NotFound):935 print(flask.safe_join(*args))937937938class TestHelpers:939 @pytest.mark.parametrize(940 "debug, expected_flag, expected_default_flag",941 [
56 unmodified lines