#24153: Python change in casing of Cookie HttpOnly attribute broke some tests
--------------------------------------+------------------------------------
     Reporter:  jdufresne             |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  HTTP handling         |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by timgraham):

 * status:  closed => new
 * stage:  Unreviewed => Accepted
 * resolution:  invalid =>


Comment:

 We need to update some tests to be case insensitive:
 {{{
 diff --git a/django/contrib/sessions/tests.py
 b/django/contrib/sessions/tests.py
 index 097cded..df9c40c 100644
 --- a/django/contrib/sessions/tests.py
 +++ b/django/contrib/sessions/tests.py
 @@ -543,7 +543,7 @@ class SessionMiddlewareTests(unittest.TestCase):
          response = middleware.process_response(request, response)
          self.assertTrue(
              response.cookies[settings.SESSION_COOKIE_NAME]['httponly'])
 -        self.assertIn('httponly',
 +        self.assertIn('HttpOnly',
              str(response.cookies[settings.SESSION_COOKIE_NAME]))

      @override_settings(SESSION_COOKIE_HTTPONLY=False)
 diff --git a/tests/requests/tests.py b/tests/requests/tests.py
 index bb36af3..63e5eee 100644
 --- a/tests/requests/tests.py
 +++ b/tests/requests/tests.py
 @@ -221,7 +221,7 @@ class RequestsTests(SimpleTestCase):
          example_cookie = response.cookies['example']
          # A compat cookie may be in use -- check that it has worked
          # both as an output string, and using the cookie attributes
 -        self.assertIn('; httponly', str(example_cookie))
 +        self.assertIn('; HttpOnly', str(example_cookie))
          self.assertTrue(example_cookie['httponly'])

      def test_unicode_cookie(self):
 }}}
 There's also this assertion in the session tests:
 {{{
 self.assertNotIn('httponly',
 str(response.cookies[settings.SESSION_COOKIE_NAME]))
 }}}
 Maybe the string could be a function of the Python version?

--
Ticket URL: <https://code.djangoproject.com/ticket/24153#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.242bf15f66d392f7306a5bbc831b7431%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to