Skip to content

Commit

Permalink
Minor update to tests, added docstrings
Browse files Browse the repository at this point in the history
Requested by @sigmavirus24.
  • Loading branch information
cdunklau committed May 1, 2013
1 parent 4f83ef8 commit f93275c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,11 @@ def test_session_pickling(self):
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
Expand All @@ -473,6 +477,10 @@ def test_fixes_1329(self):
headers['Accept'.encode('ascii')],
'application/json'
)
self.assertEqual(
headers['ACCEPT'.encode('ascii')],
'application/json'
)


class TestCaseInsensitiveDict(unittest.TestCase):
Expand Down Expand Up @@ -512,6 +520,7 @@ def test_getitem(self):
self.assertEqual(cid['SPAM'], 'blueval')

def test_fixes_649(self):
"""__setitem__ should behave case-insensitively."""
cid = CaseInsensitiveDict()
cid['spam'] = 'oneval'
cid['Spam'] = 'twoval'
Expand Down

0 comments on commit f93275c

Please sign in to comment.