Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made some `contrib.messages` tests use `override_settings` for clarit…

…y. Thanks to Claude Paroz for the patch. Refs #16507, #16574.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c1a014bba4f25e7d9c6c1a46737bcd5d490a13f7 1 parent 6df91d9
@jphalip jphalip authored
Showing with 4 additions and 10 deletions.
  1. +4 −10 django/contrib/messages/tests/cookie.py
View
14 django/contrib/messages/tests/cookie.py
@@ -3,8 +3,8 @@
from django.contrib.messages.storage.cookie import (CookieStorage,
MessageEncoder, MessageDecoder)
from django.contrib.messages.storage.base import Message
+from django.test.utils import override_settings
from django.utils import simplejson as json
-from django.conf import settings
def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
@@ -41,15 +41,6 @@ def stored_cookie_messages_count(storage, response):
class CookieTest(BaseTest):
storage_class = CookieStorage
- def setUp(self):
- super(CookieTest, self).setUp()
- self.old_SESSION_COOKIE_DOMAIN = settings.SESSION_COOKIE_DOMAIN
- settings.SESSION_COOKIE_DOMAIN = '.lawrence.com'
-
- def tearDown(self):
- super(CookieTest, self).tearDown()
- settings.SESSION_COOKIE_DOMAIN = self.old_SESSION_COOKIE_DOMAIN
-
def stored_messages_count(self, storage, response):
return stored_cookie_messages_count(storage, response)
@@ -139,3 +130,6 @@ def test_json_encoder_decoder(self):
value = encoder.encode(messages)
decoded_messages = json.loads(value, cls=MessageDecoder)
self.assertEqual(messages, decoded_messages)
+
+CookieTest = override_settings(
+ SESSION_COOKIE_DOMAIN='.lawrence.com')(CookieTest)
Please sign in to comment.
Something went wrong with that request. Please try again.