Ticket #16507: 16507.3.diff

File 16507.3.diff, 2.0 KB (added by claudep, 4 years ago)

Refreshed patch against trunk

  • django/contrib/messages/tests/base.py

    diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py
    index 8d04532..463a15f 100644
    a b class BaseTest(TestCase): 
    5656
    5757    def setUp(self):
    5858        self.settings_override = override_settings_tags(
     59            DEBUG_PROPAGATE_EXCEPTIONS = True,
    5960            TEMPLATE_DIRS   = (),
    6061            MESSAGE_TAGS    = '',
    6162            MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
  • django/contrib/messages/tests/cookie.py

    diff --git a/django/contrib/messages/tests/cookie.py b/django/contrib/messages/tests/cookie.py
    index f22ed39..30aa6b5 100644
    a b from django.contrib.messages.tests.base import BaseTest 
    33from django.contrib.messages.storage.cookie import (CookieStorage,
    44    MessageEncoder, MessageDecoder)
    55from django.contrib.messages.storage.base import Message
     6from django.test.utils import override_settings
    67from django.utils import simplejson as json
    7 from django.conf import settings
    88
    99
    1010def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
    def stored_cookie_messages_count(storage, response): 
    4141class CookieTest(BaseTest):
    4242    storage_class = CookieStorage
    4343
    44     def setUp(self):
    45         super(CookieTest, self).setUp()
    46         self.old_SESSION_COOKIE_DOMAIN = settings.SESSION_COOKIE_DOMAIN
    47         settings.SESSION_COOKIE_DOMAIN = '.lawrence.com'
    48 
    49     def tearDown(self):
    50         super(CookieTest, self).tearDown()
    51         settings.SESSION_COOKIE_DOMAIN = self.old_SESSION_COOKIE_DOMAIN
    52 
    5344    def stored_messages_count(self, storage, response):
    5445        return stored_cookie_messages_count(storage, response)
    5546
    class CookieTest(BaseTest): 
    139130        value = encoder.encode(messages)
    140131        decoded_messages = json.loads(value, cls=MessageDecoder)
    141132        self.assertEqual(messages, decoded_messages)
     133
     134CookieTest = override_settings(
     135        SESSION_COOKIE_DOMAIN='.lawrence.com')(CookieTest)
Back to Top