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
f85aa477
Commit
f85aa477
authored
Nov 10, 2016
by
Douglas Hall
Committed by
GitHub
Nov 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13956 from edx/hasnain-naveed/WL-615
WL-615 | Fix the preview certificate link.
parents
1ec55113
44548998
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
cms/djangoapps/contentstore/tests/test_utils.py
+27
-0
cms/djangoapps/contentstore/utils.py
+5
-2
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
f85aa477
...
...
@@ -11,6 +11,8 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from
xmodule.modulestore.django
import
modulestore
from
xmodule.partitions.partitions
import
UserPartition
,
Group
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration_context
from
contentstore
import
utils
from
contentstore.tests.utils
import
CourseTestCase
...
...
@@ -37,6 +39,31 @@ class LMSLinksTestCase(TestCase):
link
=
utils
.
get_lms_link_for_item
(
location
)
self
.
assertEquals
(
link
,
"//localhost:8000/courses/mitX/101/test/jump_to/i4x://mitX/101/course/test"
)
def
lms_link_for_certificate_web_view_test
(
self
):
""" Tests get_lms_link_for_certificate_web_view. """
course_key
=
SlashSeparatedCourseKey
(
'mitX'
,
'101'
,
'test'
)
dummy_user
=
ModuleStoreEnum
.
UserID
.
test
mode
=
'professional'
self
.
assertEquals
(
utils
.
get_lms_link_for_certificate_web_view
(
dummy_user
,
course_key
,
mode
),
"//localhost:8000/certificates/user/{user_id}/course/{course_key}?preview={mode}"
.
format
(
user_id
=
dummy_user
,
course_key
=
course_key
,
mode
=
mode
)
)
with
with_site_configuration_context
(
configuration
=
{
"course_org_filter"
:
"mitX"
,
"LMS_BASE"
:
"dummyhost:8000"
}):
self
.
assertEquals
(
utils
.
get_lms_link_for_certificate_web_view
(
dummy_user
,
course_key
,
mode
),
"//dummyhost:8000/certificates/user/{user_id}/course/{course_key}?preview={mode}"
.
format
(
user_id
=
dummy_user
,
course_key
=
course_key
,
mode
=
mode
)
)
class
ExtraPanelTabTestCase
(
TestCase
):
""" Tests adding and removing extra course tabs. """
...
...
cms/djangoapps/contentstore/utils.py
View file @
f85aa477
...
...
@@ -123,11 +123,14 @@ def get_lms_link_for_certificate_web_view(user_id, course_key, mode):
"""
assert
isinstance
(
course_key
,
CourseKey
)
if
settings
.
LMS_BASE
is
None
:
# checks LMS_BASE value in SiteConfiguration against course_org_filter if not found returns settings.LMS_BASE
lms_base
=
SiteConfiguration
.
get_value_for_org
(
course_key
.
org
,
"LMS_BASE"
,
settings
.
LMS_BASE
)
if
lms_base
is
None
:
return
None
return
u"//{certificate_web_base}/certificates/user/{user_id}/course/{course_id}?preview={mode}"
.
format
(
certificate_web_base
=
settings
.
LMS_BASE
,
certificate_web_base
=
lms_base
,
user_id
=
user_id
,
course_id
=
unicode
(
course_key
),
mode
=
mode
...
...
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