diff --git a/common/djangoapps/third_party_auth/tests/specs/test_google.py b/common/djangoapps/third_party_auth/tests/specs/test_google.py index 9562c0a9ac..fa6ab9beb1 100644 --- a/common/djangoapps/third_party_auth/tests/specs/test_google.py +++ b/common/djangoapps/third_party_auth/tests/specs/test_google.py @@ -96,7 +96,11 @@ class GoogleOauth2IntegrationTest(base.Oauth2IntegrationTest): }) # Check the hash that is used to confirm the user's data in the GET parameter is correct secret_key = settings.THIRD_PARTY_AUTH_CUSTOM_AUTH_FORMS['custom1']['secret_key'] - hmac_expected = hmac.new(secret_key.encode('utf-8'), msg=data_decoded.encode('utf-8'), digestmod=hashlib.sha256).digest() + hmac_expected = hmac.new( + secret_key.encode('utf-8'), + msg=data_decoded.encode('utf-8'), + digestmod=hashlib.sha256 + ).digest() self.assertEqual(base64.b64decode(response.context['hmac']), hmac_expected) # Now our custom registration form creates or logs in the user: diff --git a/lms/djangoapps/commerce/tests/test_views.py b/lms/djangoapps/commerce/tests/test_views.py index 32684badba..53afd0eca5 100644 --- a/lms/djangoapps/commerce/tests/test_views.py +++ b/lms/djangoapps/commerce/tests/test_views.py @@ -123,8 +123,14 @@ class ReceiptViewTests(UserMixin, ModuleStoreTestCase): user_message = "There was a problem with this transaction" system_message = "A system error occurred while processing your payment" - self.assertRegexpMatches(response.content.decode('utf-8'), user_message if is_user_message_expected else system_message) - self.assertNotRegexpMatches(response.content.decode('utf-8'), user_message if not is_user_message_expected else system_message) + self.assertRegexpMatches( + response.content.decode('utf-8'), + user_message if is_user_message_expected else system_message + ) + self.assertNotRegexpMatches( + response.content.decode('utf-8'), + user_message if not is_user_message_expected else system_message + ) @with_comprehensive_theme("edx.org") def test_hide_nav_header(self): diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index b6639beaa7..34bb6f6d0a 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -1310,7 +1310,7 @@ class TestEditorSavedMethod(BaseTestVideoXBlock): self.MODULESTORE = MODULESTORES[default_store] # pylint: disable=invalid-name self.initialize_block(metadata=self.metadata) item = self.store.get_item(self.item_descriptor.location) - with open(self.file_path, "rb") as myfile: + with open(self.file_path, "rb") as myfile: # pylint: disable=open-builtin save_to_store(myfile.read(), self.file_name, 'text/sjson', item.location) item.sub = "3_yD_cEKoCk" # subs_video.srt.sjson does not exist before calling editor_saved function @@ -1330,7 +1330,7 @@ class TestEditorSavedMethod(BaseTestVideoXBlock): self.MODULESTORE = MODULESTORES[default_store] self.initialize_block(metadata=self.metadata) item = self.store.get_item(self.item_descriptor.location) - with open(self.file_path, "rb") as myfile: + with open(self.file_path, "rb") as myfile: # pylint: disable=open-builtin save_to_store(myfile.read(), self.file_name, 'text/sjson', item.location) save_to_store(myfile.read(), 'subs_video.srt.sjson', 'text/sjson', item.location) item.sub = "3_yD_cEKoCk" diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py b/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py index bb867c952b..97d95576f1 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py @@ -12,6 +12,7 @@ from pytz import UTC from openedx.core.djangolib.testing.utils import skip_unless_lms from student.tests.factories import UserFactory +from six import text_type from ..image_helpers import get_profile_image_urls_for_user @@ -73,7 +74,8 @@ class ProfileImageUrlTestCase(TestCase): """ self.user.profile.profile_image_uploaded_at = TEST_PROFILE_IMAGE_UPLOAD_DT self.user.profile.save() - expected_name = hashlib.md5('secret' + self.user.username.encode('utf-8')).hexdigest() + expected_name = hashlib.md5( + 'secret' + text_type(self.user.username).encode('utf-8')).hexdigest() actual_urls = get_profile_image_urls_for_user(self.user) self.verify_urls(actual_urls, expected_name, is_default=False)