summaryrefslogtreecommitdiff
path: root/tests/responses
diff options
context:
space:
mode:
authorSergey Parkhomenko <s.y.parkhomenko@gmail.com>2014-12-11 00:25:05 +0200
committerTim Graham <timograham@gmail.com>2014-12-11 13:56:56 -0500
commit059c9ab24c41e1460fd8b7af65ea8d5f80f1aa82 (patch)
tree130b9b8169d235dd139fb446ffd1ccd82004efc3 /tests/responses
parentd4e449d73029dd512acb5f156ee5b4e93189e7b9 (diff)
downloaddjango-059c9ab24c41e1460fd8b7af65ea8d5f80f1aa82.tar.gz
Fixed #23977 -- Added setdefault() method to HttpResponse
Diffstat (limited to 'tests/responses')
-rw-r--r--tests/responses/tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/responses/tests.py b/tests/responses/tests.py
index 9642790b9a..892c09b857 100644
--- a/tests/responses/tests.py
+++ b/tests/responses/tests.py
@@ -33,6 +33,20 @@ class HttpResponseBaseTests(SimpleTestCase):
with self.assertRaisesMessage(IOError, 'This HttpResponseBase instance cannot tell its position'):
r.tell()
+ def test_setdefault(self):
+ """
+ HttpResponseBase.setdefault() should not change an existing header
+ and should be case insensitive.
+ """
+ r = HttpResponseBase()
+
+ r['Header'] = 'Value'
+ r.setdefault('header', 'changed')
+ self.assertEqual(r['header'], 'Value')
+
+ r.setdefault('x-header', 'DefaultValue')
+ self.assertEqual(r['X-Header'], 'DefaultValue')
+
class HttpResponseTests(SimpleTestCase):
def test_status_code(self):