From dfa29161e2eff676eb4aa187f76c157556dfc5db Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 16 Jun 2011 16:34:46 +0000 Subject: Fixed #14020 -- Made the `HttpResponse` class slightly more behave like a dictionary, allowing the alternative argument to be unset. Serious thanks to schmichael and moopet. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16417 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/httpwrappers/tests.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py index fbed94413b..493109a38e 100644 --- a/tests/regressiontests/httpwrappers/tests.py +++ b/tests/regressiontests/httpwrappers/tests.py @@ -243,6 +243,13 @@ class HttpResponseTests(unittest.TestCase): self.assertRaises(BadHeaderError, r.__setitem__, 'test\rstr', 'test') self.assertRaises(BadHeaderError, r.__setitem__, 'test\nstr', 'test') + def test_dict_behavior(self): + """ + Test for bug #14020: Make HttpResponse.get work like dict.get + """ + r = HttpResponse() + self.assertEqual(r.get('test'), None) + class CookieTests(unittest.TestCase): def test_encode(self): """ -- cgit v1.3