Fix linting errors.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user