Fixing python3
This commit is contained in:
Awais Qureshi
2019-09-20 15:52:29 +05:00
parent c6edb954d5
commit 4abaef5324
2 changed files with 3 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ def attach_image(img_dict, filename):
if img_path:
with open(img_path, 'rb') as img:
msg_image = MIMEImage(img.read(), name=os.path.basename(img_path))
msg_image.add_header('Content-ID', b'<{}>'.format(img_dict['cid'])) # xss-lint: disable=python-wrap-html
msg_image.add_header('Content-ID', '<{}>'.format(img_dict['cid'])) # xss-lint: disable=python-wrap-html
msg_image.add_header("Content-Disposition", "inline", filename=filename)
return msg_image

View File

@@ -702,7 +702,7 @@ class CreditRequirementApiTests(CreditApiTestBase):
# strip enclosing angle brackets from 'logo_image' cache 'Content-ID'
image_id = email_image.get('Content-ID', '')[1:-1]
self.assertIsNotNone(image_id)
self.assertIn(image_id, html_content_first.decode('utf-8'))
self.assertIn(image_id, html_content_first)
self.assertIn(
'credit from Hogwarts School of Witchcraft and Wizardry for',
html_content_first
@@ -732,7 +732,7 @@ class CreditRequirementApiTests(CreditApiTestBase):
# logo image is used
email_payload_second = mail.outbox[1].attachments[0]._payload # pylint: disable=protected-access
html_content_second = email_payload_second[0]._payload[1]._payload # pylint: disable=protected-access
self.assertIn(image_id, html_content_second.decode('utf-8'))
self.assertIn(image_id, html_content_second)
# The user should remain eligible even if the requirement status is later changed
api.set_credit_requirement_status(