MCPcopy
hub / github.com/pallets/werkzeug / test_merge_slash_encoding

Function test_merge_slash_encoding

tests/test_routing.py:139–152  ·  view source on GitHub ↗

This test is to make sure URLs are not double-encoded when a redirect is thrown with `merge_slash = True`

(path, expected)

Source from the content-addressed store, hash-verified

137 [("/merge/%//path", "/merge/%25/path"), ("/merge//st/path", "/merge/st/path")],
138)
139def test_merge_slash_encoding(path, expected):
140 """This test is to make sure URLs are not double-encoded
141 when a redirect is thrown with `merge_slash = True`"""
142 url_map = r.Map(
143 [
144 r.Rule("/merge/<some>/path"),
145 ]
146 )
147 adapter = url_map.bind("localhost", "/")
148
149 with pytest.raises(r.RequestRedirect) as excinfo:
150 adapter.match(path)
151
152 assert excinfo.value.new_url.endswith(expected)
153
154
155def test_merge_slashes_build():

Callers

nothing calls this directly

Calls 2

bindMethod · 0.95
matchMethod · 0.45

Tested by

no test coverage detected