Rewrite `test_uppercase_scheme_redirect` to use local httpbin
authorDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 24 Jul 2013 08:18:16 +0000 (17:18 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 24 Jul 2013 08:18:16 +0000 (17:18 +0900)
Instead of redirecting to hard-coded 'example.com', use the URL
defined in `HTTPBIN_URL` with the path set to the 'html' endpoint.

test_requests.py

index 9bd720fcb069b7bb9104dd831307f5b8e9626e40..0dae1e290e358961e1ad2f5638b41c5de0bce222 100755 (executable)
@@ -554,7 +554,9 @@ class RequestsTestCase(unittest.TestCase):
         )
 
     def test_uppercase_scheme_redirect(self):
-        r = requests.get(httpbin('redirect-to'), params={'url': 'HTTP://example.com/'})
+        parts = urlparse(httpbin('html'))
+        url = "HTTP://" + parts.netloc + parts.path
+        r = requests.get(httpbin('redirect-to'), params={'url': url})
         self.assertEqual(r.status_code, 200)
 
     def test_transport_adapter_ordering(self):