Removed warning check in test_load_overlong_key

Some backends issue a warning here, others not. This is not the primary
goal of the test, so the assertion about the warning has been removed.
Thanks Carl Meyer for noticing the issue and suggesting the fix.
This commit is contained in:
Claude Paroz 2012-09-08 21:25:57 +02:00
parent 3bdb65dc59
commit d7853c55ed
1 changed files with 4 additions and 6 deletions

View File

@ -302,11 +302,10 @@ class CacheDBSessionTests(SessionTestsMixin, TestCase):
self.assertTrue(self.session.exists(self.session.session_key)) self.assertTrue(self.session.exists(self.session.session_key))
def test_load_overlong_key(self): def test_load_overlong_key(self):
with warnings.catch_warnings(record=True) as w: # Some backends might issue a warning
warnings.simplefilter("always") with warnings.catch_warnings():
self.session._session_key = (string.ascii_letters + string.digits) * 20 self.session._session_key = (string.ascii_letters + string.digits) * 20
self.assertEqual(self.session.load(), {}) self.assertEqual(self.session.load(), {})
self.assertEqual(len(w), 1)
@override_settings(USE_TZ=True) @override_settings(USE_TZ=True)
@ -352,11 +351,10 @@ class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
backend = CacheSession backend = CacheSession
def test_load_overlong_key(self): def test_load_overlong_key(self):
with warnings.catch_warnings(record=True) as w: # Some backends might issue a warning
warnings.simplefilter("always") with warnings.catch_warnings():
self.session._session_key = (string.ascii_letters + string.digits) * 20 self.session._session_key = (string.ascii_letters + string.digits) * 20
self.assertEqual(self.session.load(), {}) self.assertEqual(self.session.load(), {})
self.assertEqual(len(w), 1)
class SessionMiddlewareTests(unittest.TestCase): class SessionMiddlewareTests(unittest.TestCase):