1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #22426 -- Removed pre-Django 1.5 messages compatibility code and test.

This reverts commit f286721f7f.
This commit is contained in:
Claude Paroz
2020-01-31 11:11:24 +01:00
committed by GitHub
parent a97111eabf
commit e7d62e97eb
2 changed files with 0 additions and 24 deletions

View File

@@ -153,24 +153,3 @@ class CookieTests(BaseTests, SimpleTestCase):
storage = self.get_storage()
self.assertIsInstance(encode_decode(mark_safe("<b>Hello Django!</b>")), SafeData)
self.assertNotIsInstance(encode_decode("<b>Hello Django!</b>"), SafeData)
def test_pre_1_5_message_format(self):
"""
Messages that were set in the cookie before the addition of is_safedata
are decoded correctly (#22426).
"""
# Encode the messages using the current encoder.
messages = [Message(constants.INFO, 'message %s') for x in range(5)]
encoder = MessageEncoder(separators=(',', ':'))
encoded_messages = encoder.encode(messages)
# Remove the is_safedata flag from the messages in order to imitate
# the behavior of before 1.5 (monkey patching).
encoded_messages = json.loads(encoded_messages)
for obj in encoded_messages:
obj.pop(1)
encoded_messages = json.dumps(encoded_messages, separators=(',', ':'))
# Decode the messages in the old format (without is_safedata)
decoded_messages = json.loads(encoded_messages, cls=MessageDecoder)
self.assertEqual(messages, decoded_messages)