Skip to content

Commit 4daa1bd

Browse files
authored
Merge branch 'master' into marslan/10256-course_detail_title
2 parents e6e450c + 51a7b4b commit 4daa1bd

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

cms/djangoapps/contentstore/views/transcripts_ajax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def validate_video_block(request, locator):
191191
error, item = None, None
192192
try:
193193
item = _get_item(request, {'locator': locator})
194-
if item.category != 'video':
194+
if item.usage_key.block_type != 'video':
195195
error = _('Transcripts are supported only for "video" blocks.')
196196

197197
except (InvalidKeyError, ItemNotFoundError):
@@ -523,7 +523,7 @@ def _validate_transcripts_data(request):
523523
except (InvalidKeyError, ItemNotFoundError):
524524
raise TranscriptsRequestValidationException(_("Can't find item by locator.")) # lint-amnesty, pylint: disable=raise-missing-from
525525

526-
if item.category != 'video':
526+
if item.usage_key.block_type != 'video':
527527
raise TranscriptsRequestValidationException(_('Transcripts are supported only for "video" blocks.'))
528528

529529
# parse data form request.GET.['data']['video'] to useful format

lms/djangoapps/courseware/tests/test_video_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,15 +798,15 @@ def test_translation_static_transcript(self, url, dispatch, status_code, sub=Non
798798
if sub:
799799
assert ('Location', f'/static/dummy/static/subs_{sub}.srt.sjson') in response.headerlist
800800

801-
@patch('xmodule.video_block.VideoBlock.course_id', return_value='not_a_course_locator')
801+
@patch('xmodule.video_block.VideoBlock.context_key', return_value='not_a_course_locator')
802802
def test_translation_static_non_course(self, __):
803803
"""
804804
Test that get_static_transcript short-circuits in the case of a non-CourseLocator.
805805
This fixes a bug for videos inside of content libraries.
806806
"""
807807
self._set_static_asset_path()
808808

809-
# When course_id is not mocked out, these values would result in 307, as tested above.
809+
# When context_key is not mocked out, these values would result in 307, as tested above.
810810
request = _create_djangowebobrequest_object_for_url('/translation/en?videoId=12345')
811811
response = self.block.transcript(request=request, dispatch='translation/en')
812812
assert response.status == '404 Not Found'

requirements/edx/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ xblock-utils==4.0.0
12991299
# via
13001300
# edx-sga
13011301
# xblock-poll
1302-
xblocks-contrib==0.15.1
1302+
xblocks-contrib==0.15.2
13031303
# via -r requirements/edx/bundled.in
13041304
xmlsec==1.3.14
13051305
# via

requirements/edx/development.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,7 @@ xblock-utils==4.0.0
23262326
# -r requirements/edx/testing.txt
23272327
# edx-sga
23282328
# xblock-poll
2329-
xblocks-contrib==0.15.1
2329+
xblocks-contrib==0.15.2
23302330
# via
23312331
# -r requirements/edx/doc.txt
23322332
# -r requirements/edx/testing.txt

requirements/edx/doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ xblock-utils==4.0.0
16371637
# -r requirements/edx/base.txt
16381638
# edx-sga
16391639
# xblock-poll
1640-
xblocks-contrib==0.15.1
1640+
xblocks-contrib==0.15.2
16411641
# via -r requirements/edx/base.txt
16421642
xmlsec==1.3.14
16431643
# via

requirements/edx/testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ xblock-utils==4.0.0
17321732
# -r requirements/edx/base.txt
17331733
# edx-sga
17341734
# xblock-poll
1735-
xblocks-contrib==0.15.1
1735+
xblocks-contrib==0.15.2
17361736
# via -r requirements/edx/base.txt
17371737
xmlsec==1.3.14
17381738
# via

xmodule/tests/test_import.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def test_metadata_inherit(self):
428428

429429
def check_for_key(key, node, value):
430430
"recursive check for presence of key"
431-
print(f"Checking {str(node.location)}")
431+
print(f"Checking {str(node.usage_key)}")
432432
assert getattr(node, key) == value
433433
for c in node.get_children():
434434
check_for_key(key, c, value)
@@ -442,8 +442,8 @@ def test_policy_loading(self):
442442
toy = self.get_course('toy')
443443
two_toys = self.get_course('two_toys')
444444

445-
assert toy.url_name == '2012_Fall'
446-
assert two_toys.url_name == 'TT_2012_Fall'
445+
assert toy.usage_key.block_id == '2012_Fall'
446+
assert two_toys.usage_key.block_id == 'TT_2012_Fall'
447447

448448
toy_ch = toy.get_children()[0]
449449
two_toys_ch = two_toys.get_children()[0]
@@ -513,7 +513,7 @@ def test_colon_in_url_name(self):
513513
assert len(chapters) == 5
514514

515515
ch2 = chapters[1]
516-
assert ch2.url_name == 'secret:magic'
516+
assert ch2.usage_key.block_id == 'secret:magic'
517517

518518
print("Ch2 location: ", ch2.location)
519519

@@ -567,8 +567,8 @@ def test_url_name_mangling(self):
567567
for i in (2, 3):
568568
video = sections[i]
569569
# Name should be 'video_{hash}'
570-
print(f"video {i} url_name: {video.url_name}")
571-
assert len(video.url_name) == (len('video_') + 12)
570+
print(f"video {i} url_name: {video.usage_key.block_id}")
571+
assert len(video.usage_key.block_id) == (len('video_') + 12)
572572

573573
def test_poll_and_conditional_import(self):
574574
modulestore = XMLModuleStore(DATA_DIR, source_dirs=['conditional_and_poll'])

xmodule/tests/test_lti_unit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ def mock_handler_url(block, handler_name, **kwargs): # pylint: disable=unused-a
325325
assert real_outcome_service_url == (mock_url_prefix + test_service_name)
326326

327327
def test_resource_link_id(self):
328-
with patch('xmodule.lti_block.LTIBlock.location', new_callable=PropertyMock):
329-
self.xblock.location.html_id = lambda: 'i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
328+
with patch('xmodule.lti_block.LTIBlock.usage_key', new_callable=PropertyMock):
329+
self.xblock.usage_key.html_id = lambda: 'i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
330330
expected_resource_link_id = str(parse.quote(self.unquoted_resource_link_id))
331331
real_resource_link_id = self.xblock.get_resource_link_id()
332332
assert real_resource_link_id == expected_resource_link_id

0 commit comments

Comments
 (0)