0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Removed redundant usage of assertNotIn() in a mail test.

The Content-Transfer-Encoding header won't be repeated, so checking
the header is sufficient.
This commit is contained in:
Tim Graham 2016-10-12 14:23:37 -04:00
parent a3a10f8abe
commit b2f9db1637

View File

@ -554,7 +554,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
'Subject', 'UTF-8 encoded body', 'bounce@example.com', ['to@example.com'], 'Subject', 'UTF-8 encoded body', 'bounce@example.com', ['to@example.com'],
headers={'From': 'from@example.com'}, headers={'From': 'from@example.com'},
) )
self.assertNotIn(b'Content-Transfer-Encoding: base64', msg.message().as_bytes()) self.assertIn(b'Content-Transfer-Encoding: 7bit', msg.message().as_bytes())
# Ticket #11212 # Ticket #11212
# Shouldn't use quoted printable, should detect it can represent content with 7 bit data # Shouldn't use quoted printable, should detect it can represent content with 7 bit data
@ -563,7 +563,6 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
headers={'From': 'from@example.com'}, headers={'From': 'from@example.com'},
) )
s = msg.message().as_bytes() s = msg.message().as_bytes()
self.assertNotIn(b'Content-Transfer-Encoding: quoted-printable', s)
self.assertIn(b'Content-Transfer-Encoding: 7bit', s) self.assertIn(b'Content-Transfer-Encoding: 7bit', s)
# Shouldn't use quoted printable, should detect it can represent content with 8 bit data # Shouldn't use quoted printable, should detect it can represent content with 8 bit data
@ -572,7 +571,6 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
headers={'From': 'from@example.com'}, headers={'From': 'from@example.com'},
) )
s = msg.message().as_bytes() s = msg.message().as_bytes()
self.assertNotIn(b'Content-Transfer-Encoding: quoted-printable', s)
self.assertIn(b'Content-Transfer-Encoding: 8bit', s) self.assertIn(b'Content-Transfer-Encoding: 8bit', s)
msg = EmailMessage( msg = EmailMessage(
@ -580,7 +578,6 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
['to@example.com'], headers={'From': 'from@example.com'}, ['to@example.com'], headers={'From': 'from@example.com'},
) )
s = msg.message().as_bytes() s = msg.message().as_bytes()
self.assertNotIn(b'Content-Transfer-Encoding: quoted-printable', s)
self.assertIn(b'Content-Transfer-Encoding: 8bit', s) self.assertIn(b'Content-Transfer-Encoding: 8bit', s)
def test_dont_base64_encode_message_rfc822(self): def test_dont_base64_encode_message_rfc822(self):