Skip to content

Commit

Permalink
Test whether non-UTF-8 encoded paths in URLs are left intact
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-nagel committed Jan 19, 2017
1 parent ffd0fce commit 2d4bde5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_surt.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ def test_surt():
assert surt.surt("warcinfo:foo.warc.gz", with_scheme=True) == 'warcinfo:foo.warc.gz'
assert surt.surt("warcinfo:foo.warc.gz", with_scheme=True, trailing_comma=True) == 'warcinfo:foo.warc.gz'

def test_unescape_encoding():
# percent encoding, utf-8 encoded characters
assert surt.surt("http://example.com/city-of-M%C3%BCnchen.html") == 'com,example)/city-of-m%c3%bcnchen.html'
# percent encoding, latin-1 encoded characters (pre-RFC3986)
assert surt.surt("http://example.com/city-of-M%FCnchen.html") == 'com,example)/city-of-m%fcnchen.html'

def test_options():
assert surt.IAURLCanonicalizer.canonicalize(handyurl.parse('http://example.com/foo?X=Y')).getURLString() == 'http://example.com/foo?x=y'
assert surt.IAURLCanonicalizer.canonicalize(handyurl.parse('http://example.com/foo?X=Y'), query_lowercase=False).getURLString() == 'http://example.com/foo?X=Y'
Expand Down

0 comments on commit 2d4bde5

Please sign in to comment.