Minor update to tests, added docstrings
authorColin Dunklau <colin.dunklau@gmail.com>
Wed, 1 May 2013 17:48:21 +0000 (12:48 -0500)
committerColin Dunklau <colin.dunklau@gmail.com>
Wed, 1 May 2013 17:51:09 +0000 (12:51 -0500)
Requested by @sigmavirus24.

test_requests.py

index 953eccac22fb595aaf356cdd011317218bef6b33..da0adb1f97906e05e9ae0b08244f1eb81ca5e33d 100644 (file)
@@ -460,7 +460,11 @@ class RequestsTestCase(unittest.TestCase):
         self.assertEqual(r.status_code, 200)
 
     def test_fixes_1329(self):
+        """
+        Ensure that header updates are done case-insensitively.
+        """
         s = requests.Session()
+        s.headers.update({'ACCEPT': 'BOGUS'})
         s.headers.update({'accept': 'application/json'})
         r = s.get(httpbin('get'))
         headers = r.request.headers
@@ -473,6 +477,10 @@ class RequestsTestCase(unittest.TestCase):
             headers['Accept'.encode('ascii')],
             'application/json'
         )
+        self.assertEqual(
+            headers['ACCEPT'.encode('ascii')],
+            'application/json'
+        )
 
 
 class TestCaseInsensitiveDict(unittest.TestCase):
@@ -512,6 +520,7 @@ class TestCaseInsensitiveDict(unittest.TestCase):
         self.assertEqual(cid['SPAM'], 'blueval')
 
     def test_fixes_649(self):
+        """__setitem__ should behave case-insensitively."""
         cid = CaseInsensitiveDict()
         cid['spam'] = 'oneval'
         cid['Spam'] = 'twoval'