Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c1789adf
Commit
c1789adf
authored
Sep 17, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always return a Locator: cases weren't exhaustive.
parent
934b3ca7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
common/lib/xmodule/xmodule/modulestore/locator.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
+14
-0
No files found.
common/lib/xmodule/xmodule/modulestore/locator.py
View file @
c1789adf
...
@@ -377,7 +377,7 @@ class BlockUsageLocator(CourseLocator):
...
@@ -377,7 +377,7 @@ class BlockUsageLocator(CourseLocator):
:param block_locator:
:param block_locator:
"""
"""
if
self
.
course_id
and
self
.
version_guid
:
if
self
.
version_guid
:
return
BlockUsageLocator
(
version_guid
=
self
.
version_guid
,
return
BlockUsageLocator
(
version_guid
=
self
.
version_guid
,
branch
=
self
.
branch
,
branch
=
self
.
branch
,
usage_id
=
self
.
usage_id
)
usage_id
=
self
.
usage_id
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_locators.py
View file @
c1789adf
...
@@ -208,6 +208,12 @@ class LocatorTest(TestCase):
...
@@ -208,6 +208,12 @@ class LocatorTest(TestCase):
block
=
expected_block_ref
)
block
=
expected_block_ref
)
self
.
assertEqual
(
str
(
testobj
),
testurn
)
self
.
assertEqual
(
str
(
testobj
),
testurn
)
self
.
assertEqual
(
testobj
.
url
(),
'edx://'
+
testurn
)
self
.
assertEqual
(
testobj
.
url
(),
'edx://'
+
testurn
)
agnostic
=
testobj
.
version_agnostic
()
self
.
assertIsNone
(
agnostic
.
version_guid
)
self
.
check_block_locn_fields
(
agnostic
,
'test_block constructor'
,
course_id
=
expected_id
,
branch
=
expected_branch
,
block
=
expected_block_ref
)
def
test_block_constructor_url_version_prefix
(
self
):
def
test_block_constructor_url_version_prefix
(
self
):
test_id_loc
=
'519665f6223ebd6980884f2b'
test_id_loc
=
'519665f6223ebd6980884f2b'
...
@@ -220,6 +226,14 @@ class LocatorTest(TestCase):
...
@@ -220,6 +226,14 @@ class LocatorTest(TestCase):
block
=
'lab2'
,
block
=
'lab2'
,
version_guid
=
ObjectId
(
test_id_loc
)
version_guid
=
ObjectId
(
test_id_loc
)
)
)
agnostic
=
testobj
.
version_agnostic
()
self
.
check_block_locn_fields
(
agnostic
,
'error parsing URL with version and block'
,
block
=
'lab2'
,
course_id
=
None
,
version_guid
=
ObjectId
(
test_id_loc
)
)
self
.
assertIsNone
(
agnostic
.
course_id
)
def
test_block_constructor_url_kitchen_sink
(
self
):
def
test_block_constructor_url_kitchen_sink
(
self
):
test_id_loc
=
'519665f6223ebd6980884f2b'
test_id_loc
=
'519665f6223ebd6980884f2b'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment