Skip to content

Commit a5d3e4f

Browse files
authored
Merge branch 'master' into pwnage101/ENT-11510
2 parents 4fdc02c + a761f07 commit a5d3e4f

1,240 files changed

Lines changed: 9353 additions & 9426 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
# This will make sure the app is always imported when Django starts so
2222
# that shared_task will use this app, and also ensures that the celery
2323
# singleton is always configured for the CMS.
24-
from .celery import APP as CELERY_APP # lint-amnesty, pylint: disable=wrong-import-position
24+
from .celery import APP as CELERY_APP # lint-amnesty, pylint: disable=wrong-import-position # noqa: F401

cms/celery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# Set the default Django settings module for the 'celery' program
1717
# and then instantiate the Celery singleton.
1818
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cms.envs.production')
19-
from openedx.core.lib.celery import APP # pylint: disable=wrong-import-position,unused-import
19+
from openedx.core.lib.celery import APP # pylint: disable=wrong-import-position,unused-import # noqa: F401

cms/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def pytest_configure(config):
2828
logging.info("pytest did not register json_report correctly")
2929

3030

31-
@pytest.fixture(autouse=True, scope='function')
31+
@pytest.fixture(autouse=True, scope='function') # noqa: PT003
3232
def _django_clear_site_cache():
3333
"""
3434
pytest-django uses this fixture to automatically clear the Site object

cms/djangoapps/api/v1/serializers/course_runs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def to_internal_value(self, data):
4545
try:
4646
User.objects.get(username=member['user'])
4747
except User.DoesNotExist:
48-
raise serializers.ValidationError( # lint-amnesty, pylint: disable=raise-missing-from
48+
raise serializers.ValidationError( # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
4949
_('Course team user does not exist')
5050
)
5151

@@ -171,7 +171,7 @@ def validate(self, attrs):
171171
with store.default_store('split'):
172172
new_course_run_key = store.make_course_key(course_run_key.org, number, run)
173173
except InvalidKeyError:
174-
raise serializers.ValidationError( # lint-amnesty, pylint: disable=raise-missing-from
174+
raise serializers.ValidationError( # lint-amnesty, pylint: disable=raise-missing-from # noqa: B904
175175
'Invalid key supplied. Ensure there are no special characters in the Course Number.'
176176
)
177177
if store.has_course(new_course_run_key, ignore_case=True):

cms/djangoapps/api/v1/tests/test_views/test_course_runs.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
import datetime
5-
from unittest.mock import patch # lint-amnesty, pylint: disable=unused-import
5+
from unittest.mock import patch # lint-amnesty, pylint: disable=unused-import # noqa: F401
66

77
import ddt
88
import pytz
@@ -266,15 +266,15 @@ def test_create(self, pacing_type, expected_self_paced_value):
266266
data = self.get_course_run_data(user, start, end, pacing_type, role)
267267

268268
response = self.client.post(self.list_url, data, format='json')
269-
self.assertEqual(response.status_code, 201)
269+
self.assertEqual(response.status_code, 201) # noqa: PT009
270270

271271
course_run_key = CourseKey.from_string(response.data['id'])
272272
course_run = modulestore().get_course(course_run_key)
273-
self.assertEqual(course_run.display_name, data['title'])
274-
self.assertEqual(course_run.id.org, data['org'])
275-
self.assertEqual(course_run.id.course, data['number'])
276-
self.assertEqual(course_run.id.run, data['run'])
277-
self.assertEqual(course_run.self_paced, expected_self_paced_value)
273+
self.assertEqual(course_run.display_name, data['title']) # noqa: PT009
274+
self.assertEqual(course_run.id.org, data['org']) # noqa: PT009
275+
self.assertEqual(course_run.id.course, data['number']) # noqa: PT009
276+
self.assertEqual(course_run.id.run, data['run']) # noqa: PT009
277+
self.assertEqual(course_run.self_paced, expected_self_paced_value) # noqa: PT009
278278
self.assert_course_run_schedule(course_run, start, end)
279279
self.assert_access_role(course_run, user, role)
280280
self.assert_course_access_role_count(course_run, 1)
@@ -290,8 +290,8 @@ def test_create_with_invalid_course_team(self):
290290
data = self.get_course_run_data(user, start, end, 'self-paced')
291291
data['team'] = [{'user': 'invalid-username'}]
292292
response = self.client.post(self.list_url, data, format='json')
293-
self.assertEqual(response.status_code, 400)
294-
self.assertEqual(response.data.get('team'), ['Course team user does not exist'])
293+
self.assertEqual(response.status_code, 400) # noqa: PT009
294+
self.assertEqual(response.data.get('team'), ['Course team user does not exist']) # noqa: PT009
295295

296296
def test_images_upload(self):
297297
# http://www.django-rest-framework.org/api-guide/parsers/#fileuploadparser
@@ -382,8 +382,8 @@ def test_rerun(self, pacing_type, expected_self_paced_value, number):
382382
self.assert_access_role(course_run, user, role)
383383
self.assert_course_access_role_count(course_run, 1)
384384
course_orgs = get_course_organizations(course_run_key)
385-
self.assertEqual(len(course_orgs), 1)
386-
self.assertEqual(course_orgs[0]['short_name'], original_course_run.id.org) # lint-amnesty, pylint: disable=no-member
385+
self.assertEqual(len(course_orgs), 1) # noqa: PT009
386+
self.assertEqual(course_orgs[0]['short_name'], original_course_run.id.org) # lint-amnesty, pylint: disable=no-member # noqa: PT009
387387

388388
def test_rerun_duplicate_run(self):
389389
course_run = ToyCourseFactory()
@@ -417,7 +417,7 @@ def test_clone_course(self):
417417
}
418418
response = self.client.post(url, data, format='json')
419419
assert response.status_code == 201
420-
self.assertEqual(response.data, {"message": "Course cloned successfully."})
420+
self.assertEqual(response.data, {"message": "Course cloned successfully."}) # noqa: PT009
421421

422422
def test_clone_course_with_missing_source_id(self):
423423
url = reverse('api:v1:course_run-clone')
@@ -426,7 +426,7 @@ def test_clone_course_with_missing_source_id(self):
426426
}
427427
response = self.client.post(url, data, format='json')
428428
assert response.status_code == 400
429-
self.assertEqual(response.data, {'source_course_id': ['This field is required.']})
429+
self.assertEqual(response.data, {'source_course_id': ['This field is required.']}) # noqa: PT009
430430

431431
def test_clone_course_with_missing_dest_id(self):
432432
url = reverse('api:v1:course_run-clone')
@@ -435,7 +435,7 @@ def test_clone_course_with_missing_dest_id(self):
435435
}
436436
response = self.client.post(url, data, format='json')
437437
assert response.status_code == 400
438-
self.assertEqual(response.data, {'destination_course_id': ['This field is required.']})
438+
self.assertEqual(response.data, {'destination_course_id': ['This field is required.']}) # noqa: PT009
439439

440440
def test_clone_course_with_nonexistent_source_course(self):
441441
url = reverse('api:v1:course_run-clone')

cms/djangoapps/api/v1/views/course_runs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_object(self):
2929
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
3030

3131
assert lookup_url_kwarg in self.kwargs, (
32-
'Expected view %s to be called with a URL keyword argument '
32+
'Expected view %s to be called with a URL keyword argument ' # noqa: UP031
3333
'named "%s". Fix your URL conf, or set the `.lookup_field` '
3434
'attribute on the view correctly.' %
3535
(self.__class__.__name__, lookup_url_kwarg)

cms/djangoapps/cms_user_tasks/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ def ready(self):
1717
"""
1818
Connect signal handlers.
1919
"""
20-
from . import signals # pylint: disable=unused-import
20+
from . import signals # pylint: disable=unused-import # noqa: F401

cms/djangoapps/cms_user_tasks/tests.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ def create_olx_validation_artifact(self):
176176

177177
def assert_msg_subject(self, msg):
178178
"""Verify that msg subject is in expected format."""
179-
subject = "{platform_name} {studio_name}: Task Status Update".format(
179+
subject = "{platform_name} {studio_name}: Task Status Update".format( # noqa: UP032
180180
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME
181181
)
182-
self.assertEqual(msg.subject, subject)
182+
self.assertEqual(msg.subject, subject) # noqa: PT009
183183

184184
def assert_msg_body_fragments(self, msg, body_fragments):
185185
"""Verify that email body contains expected fragments"""
186186
for fragment in body_fragments:
187-
self.assertIn(fragment, msg.body)
187+
self.assertIn(fragment, msg.body) # noqa: PT009
188188

189189
def test_email_sent_with_site(self):
190190
"""
@@ -201,7 +201,7 @@ def test_email_sent_with_site(self):
201201
reverse('usertaskstatus-detail', args=[self.status.uuid])
202202
]
203203

204-
self.assertEqual(len(mail.outbox), 1)
204+
self.assertEqual(len(mail.outbox), 1) # noqa: PT009
205205

206206
msg = mail.outbox[0]
207207

@@ -216,7 +216,7 @@ def test_email_not_sent_with_libary_import_task(self):
216216
end_of_task_status.name = "bulk_migrate_from_modulestore"
217217
user_task_stopped.send(sender=UserTaskStatus, status=end_of_task_status)
218218

219-
self.assertEqual(len(mail.outbox), 0)
219+
self.assertEqual(len(mail.outbox), 0) # noqa: PT009
220220

221221
def test_email_not_sent_with_libary_content_update(self):
222222
"""
@@ -229,7 +229,7 @@ def test_email_not_sent_with_libary_content_update(self):
229229
end_of_task_status.name = "updating block-v1:course+type@library_content+block@uuid from library"
230230
user_task_stopped.send(sender=UserTaskStatus, status=end_of_task_status)
231231

232-
self.assertEqual(len(mail.outbox), 0)
232+
self.assertEqual(len(mail.outbox), 0) # noqa: PT009
233233

234234
def test_email_not_sent_with_legacy_libary_content_ref_update(self):
235235
"""
@@ -239,7 +239,7 @@ def test_email_not_sent_with_legacy_libary_content_ref_update(self):
239239
end_of_task_status.name = "Updating legacy library content blocks references of course-v1:UNIX+UN1+2025_T4"
240240
user_task_stopped.send(sender=UserTaskStatus, status=end_of_task_status)
241241

242-
self.assertEqual(len(mail.outbox), 0)
242+
self.assertEqual(len(mail.outbox), 0) # noqa: PT009
243243

244244
def test_email_sent_with_olx_validations_with_config_enabled(self):
245245
"""
@@ -258,7 +258,7 @@ def test_email_sent_with_olx_validations_with_config_enabled(self):
258258
user_task_stopped.send(sender=UserTaskStatus, status=self.status)
259259
msg = mail.outbox[0]
260260

261-
self.assertEqual(len(mail.outbox), 1)
261+
self.assertEqual(len(mail.outbox), 1) # noqa: PT009
262262
self.assert_msg_subject(msg)
263263
self.assert_msg_body_fragments(msg, body_fragments_with_validation)
264264

@@ -277,8 +277,8 @@ def test_email_sent_with_olx_validations_with_default_config(self):
277277
msg = mail.outbox[0]
278278

279279
# Verify olx validation is not enabled out of the box.
280-
self.assertFalse(settings.FEATURES.get('ENABLE_COURSE_OLX_VALIDATION'))
281-
self.assertEqual(len(mail.outbox), 1)
280+
self.assertFalse(settings.FEATURES.get('ENABLE_COURSE_OLX_VALIDATION')) # noqa: PT009
281+
self.assertEqual(len(mail.outbox), 1) # noqa: PT009
282282
self.assert_msg_subject(msg)
283283
self.assert_msg_body_fragments(msg, body_fragments)
284284

@@ -298,11 +298,11 @@ def test_email_sent_with_olx_validations_with_bypass_flag(self):
298298

299299
user_task_stopped.send(sender=UserTaskStatus, status=self.status)
300300

301-
self.assertEqual(len(mail.outbox), 1)
301+
self.assertEqual(len(mail.outbox), 1) # noqa: PT009
302302
msg = mail.outbox[0]
303303
self.assert_msg_subject(msg)
304304
self.assert_msg_body_fragments(msg, body_fragments)
305-
self.assertNotIn("Here are some validations we found with your course content.", msg.body)
305+
self.assertNotIn("Here are some validations we found with your course content.", msg.body) # noqa: PT009
306306

307307
def test_email_not_sent_for_child(self):
308308
"""
@@ -312,7 +312,7 @@ def test_email_not_sent_for_child(self):
312312
user=self.user, task_id=str(uuid4()), task_class='test_rest_api.sample_task', name='SampleTask 2',
313313
total_steps=5, parent=self.status)
314314
user_task_stopped.send(sender=UserTaskStatus, status=child_status)
315-
self.assertEqual(len(mail.outbox), 0)
315+
self.assertEqual(len(mail.outbox), 0) # noqa: PT009
316316

317317
def test_email_sent_without_site(self):
318318
"""
@@ -325,7 +325,7 @@ def test_email_sent_without_site(self):
325325
"Sign in to view the details of your task or download any files created."
326326
]
327327

328-
self.assertEqual(len(mail.outbox), 1)
328+
self.assertEqual(len(mail.outbox), 1) # noqa: PT009
329329

330330
msg = mail.outbox[0]
331331
self.assert_msg_subject(msg)
@@ -342,7 +342,7 @@ def test_email_retries(self):
342342

343343
with mock.patch('cms.djangoapps.cms_user_tasks.tasks.send_task_complete_email.retry') as mock_retry:
344344
user_task_stopped.send(sender=UserTaskStatus, status=self.status)
345-
self.assertTrue(mock_retry.called)
345+
self.assertTrue(mock_retry.called) # noqa: PT009
346346

347347
def test_queue_email_failure(self):
348348
logger = logging.getLogger("cms.djangoapps.cms_user_tasks.signals")
@@ -354,5 +354,5 @@ def test_queue_email_failure(self):
354354
{'error_response': 'error occurred'}, {'operation_name': 'test'}
355355
)
356356
user_task_stopped.send(sender=UserTaskStatus, status=self.status)
357-
self.assertTrue(mock_delay.called)
358-
self.assertEqual(hdlr.messages['error'][0], 'Unable to queue send_task_complete_email')
357+
self.assertTrue(mock_delay.called) # noqa: PT009
358+
self.assertEqual(hdlr.messages['error'][0], 'Unable to queue send_task_complete_email') # noqa: PT009
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Contentstore API"""
2-
from .views.utils import course_author_access_required, get_ready_to_migrate_legacy_library_content_blocks
2+
from .views.utils import course_author_access_required, get_ready_to_migrate_legacy_library_content_blocks # noqa: F401

cms/djangoapps/contentstore/api/tests/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def initialize_course(cls, course):
6666
parent_location=cls.section.location,
6767
category="sequential",
6868
)
69-
unit2 = BlockFactory.create(
69+
unit2 = BlockFactory.create( # noqa: F841
7070
parent_location=cls.subsection2.location,
7171
category="vertical",
7272
)

0 commit comments

Comments
 (0)