Skip to content
Myr

updated tests with IDNA encoded and IPv6 urls

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

authored by Nate Prewitt · committed by Nate Prewitt · parent 362da46 · Browse files · 2 files+27 added−0 removed
This commit

State

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

Diff stats

2 files+27 added−0 removed

  • tests:+27 added−0 removed

2 files+27 added−0 removed

modified:tests/test_requests.py+14 added
2091 unmodified lines
2092 'url,expected',2093 (2094 ('http://google.com', 'http://google.com/'),2095 (u'http://ジェーピーニック.jp', u'http://xn--hckqz9bzb1cyrb.jp/'),2096 (u'http://xn--n3h.net/', u'http://xn--n3h.net/'),2097 (2098 u'http://ジェーピーニック.jp'.encode('utf-8'),2099 u'http://xn--hckqz9bzb1cyrb.jp/'2100 ),
12 unmodified lines
2113 (2114 u'http://Königsgäßchen.de/straße'.encode('utf-8'),2115 u'http://xn--knigsgchen-b4a3dun.de/stra%C3%9Fe'2116 ),2117 (2118 b'http://xn--n3h.net/',2119 u'http://xn--n3h.net/'2120 ),2121 (2122 b'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/',2123 u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'2124 ),2125 (2126 u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/',2127 u'http://[1200:0000:ab00:1234:0000:2552:7777:1313]:12345/'2128 )2129 )2130 )2131 def test_preparing_url(self, url, expected):2132 r = requests.Request(url=url)
6 unmodified lines
2139 b"http://*.google.com",2140 b"http://*",2141 u"http://*.google.com",2142 u"http://*",2143 u"http://☃.net/"2144 )2145 )2146 def test_preparing_bad_url(self, url):2147 r = requests.Request(url=url)
2 unmodified lines
modified:tests/test_utils.py+13 added
15 unmodified lines
16 requote_uri, select_proxy, should_bypass_proxies, super_len,17 to_key_val_list, to_native_string,18 unquote_header_value, unquote_unreserved,19 urldefragauth, add_dict_to_cookiejar)20from requests._internal_utils import unicode_is_ascii2122from .compat import StringIO, cStringIO2324
490 unmodified lines
515 monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')516 monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')517 assert should_bypass_proxies(url) == expected518519520@pytest.mark.parametrize(521 'cookiejar', (522 compat.cookielib.CookieJar(),523 RequestsCookieJar()
6 unmodified lines
530 'good': 'cookies'}531 cj = add_dict_to_cookiejar(cookiejar, cookiedict)532 cookies = dict((cookie.name, cookie.value) for cookie in cj)533 assert cookiedict == cookies534535536@pytest.mark.parametrize(537 'value, expected', (538 (u'test', True),539 (u'æíöû', False),540 (u'ジェーピーニック', False),541 )542)543def test_unicode_is_ascii(value, expected):544 assert unicode_is_ascii(value) is expected