From 4abaef53247229e9df2847d771be6362d50c4e9e Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Fri, 20 Sep 2019 15:52:29 +0500 Subject: [PATCH] BOM-729 Fixing python3 --- openedx/core/djangoapps/credit/email_utils.py | 2 +- openedx/core/djangoapps/credit/tests/test_api.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/credit/email_utils.py b/openedx/core/djangoapps/credit/email_utils.py index 36450a594c..1313b840e2 100644 --- a/openedx/core/djangoapps/credit/email_utils.py +++ b/openedx/core/djangoapps/credit/email_utils.py @@ -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 diff --git a/openedx/core/djangoapps/credit/tests/test_api.py b/openedx/core/djangoapps/credit/tests/test_api.py index 4a3e5adc02..3c8b5f7039 100644 --- a/openedx/core/djangoapps/credit/tests/test_api.py +++ b/openedx/core/djangoapps/credit/tests/test_api.py @@ -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(