Tests for #1767.
authorCory Benfield <lukasaoz@gmail.com>
Sun, 1 Dec 2013 10:23:09 +0000 (10:23 +0000)
committerCory Benfield <lukasaoz@gmail.com>
Sun, 1 Dec 2013 10:29:10 +0000 (10:29 +0000)
test_requests.py

index 3b67395..8cb548b 100755 (executable)
@@ -563,6 +563,18 @@ class RequestsTestCase(unittest.TestCase):
         url = 'http://user:pass@complex.url.com/path?query=yes'
         assert ('user', 'pass') == requests.utils.get_auth_from_url(url)
 
+    def test_get_auth_from_url_encoded_spaces(self):
+        url = 'http://user:pass%20pass@complex.url.com/path?query=yes'
+        assert ('user', 'pass pass') == requests.utils.get_auth_from_url(url)
+
+    def test_get_auth_from_url_not_encoded_spaces(self):
+        url = 'http://user:pass pass@complex.url.com/path?query=yes'
+        assert ('user', 'pass pass') == requests.utils.get_auth_from_url(url)
+
+    def test_get_auth_from_url_percent_chars(self):
+        url = 'http://user%user:pass@complex.url.com/path?query=yes'
+        assert ('user%user', 'pass') == requests.utils.get_auth_from_url(url)
+
     def test_cannot_send_unprepared_requests(self):
         r = requests.Request(url=HTTPBIN)
         with pytest.raises(ValueError):