@@ -35,7 +35,9 @@ def test_send_error_to_admins(self, send_smtp_mock):
3535 self .assertEqual (msg ['to' ], 'admin@example.com' , 'Email recipient should be the admins' )
3636 self .assertIn ('error' , msg ['subject' ], 'Email subject should indicate error' )
3737 self .assertFalse (msg .is_multipart (), 'Nomcom feedback error sent to admin should not have attachments' )
38- content = msg .get_payload ()
38+ # decode=True decodes the quoted-printable encoding, including removing soft linebreaks.
39+ # The .decode() converts the resulting octet-stream bytes to a string
40+ content = msg .get_payload (decode = True ).decode ()
3941 self .assertIn ('CommandError' , content , 'Admin email should contain error type' )
4042 self .assertIn ('feedback_email.py' , content , 'Admin email should contain file where error occurred' )
4143 self .assertNotIn ('traceback' , content .lower (), 'Admin email should not contain traceback' )
@@ -63,7 +65,8 @@ def test_send_error_to_chair(self, create_feedback_mock, send_smtp_mock):
6365 self .assertTrue (msg .is_multipart (), 'Chair feedback error should have attachments' )
6466 parts = msg .get_payload ()
6567 content = parts [0 ].get_payload ()
66- # decode=True decodes the base64 encoding, .decode() converts the octet-stream bytes to a string
68+ # decode=True decodes the quoted-printable encoding, including removing soft linebreaks.
69+ # The .decode() converts the resulting octet-stream bytes to a string
6770 attachment = parts [1 ].get_payload (decode = True ).decode ()
6871 self .assertIn ('RuntimeError' , content , 'Nomcom email should contain error type' )
6972 self .assertIn ('mock.py' , content , 'Nomcom email should contain file where error occurred' )
0 commit comments