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
c230f22b
Commit
c230f22b
authored
Aug 24, 2015
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SOL-1097
parent
73722c47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
lms/djangoapps/certificates/tests/test_views.py
+16
-0
lms/djangoapps/certificates/views/webview.py
+15
-15
No files found.
lms/djangoapps/certificates/tests/test_views.py
View file @
c230f22b
...
...
@@ -39,6 +39,8 @@ from certificates.tests.factories import (
BadgeAssertionFactory
,
)
from
util
import
organizations_helpers
as
organizations_api
from
django.test.client
import
RequestFactory
import
urllib
FEATURES_WITH_CERTS_ENABLED
=
settings
.
FEATURES
.
copy
()
FEATURES_WITH_CERTS_ENABLED
[
'CERTIFICATES_HTML_VIEW'
]
=
True
...
...
@@ -379,6 +381,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
self
.
user
.
profile
.
name
=
"Joe User"
self
.
user
.
profile
.
save
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
'foo'
)
self
.
request
=
RequestFactory
()
.
request
()
self
.
cert
=
GeneratedCertificate
.
objects
.
create
(
user
=
self
.
user
,
...
...
@@ -458,6 +461,19 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
template
.
save
()
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_linkedin_share_url
(
self
):
"""
Test: LinkedIn share URL.
"""
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
1
,
is_active
=
True
)
test_url
=
get_certificate_url
(
user_id
=
self
.
user
.
id
,
course_id
=
unicode
(
self
.
course
.
id
)
)
response
=
self
.
client
.
get
(
test_url
)
self
.
assertTrue
(
urllib
.
quote_plus
(
self
.
request
.
build_absolute_uri
(
test_url
))
in
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_rendering_course_organization_data
(
self
):
"""
Test: organization data should render on certificate web view if course has organization.
...
...
lms/djangoapps/certificates/views/webview.py
View file @
c230f22b
...
...
@@ -228,21 +228,6 @@ def _update_certificate_context(context, course, user, user_certificate):
if
certificate_type_description
:
context
[
'certificate_type_description'
]
=
certificate_type_description
# If enabled, show the LinkedIn "add to profile" button
# Clicking this button sends the user to LinkedIn where they
# can add the certificate information to their profile.
linkedin_config
=
LinkedInAddToProfileConfiguration
.
current
()
if
linkedin_config
.
enabled
:
context
[
'linked_in_url'
]
=
linkedin_config
.
add_to_profile_url
(
course
.
id
,
course
.
display_name
,
user_certificate
.
mode
,
get_certificate_url
(
user_id
=
user
.
id
,
course_id
=
unicode
(
course
.
id
)
)
)
# Translators: This line is displayed to a user who has completed a course and achieved a certification
context
[
'accomplishment_banner_opening'
]
=
_
(
"{fullname}, you've earned a certificate!"
)
.
format
(
fullname
=
user_fullname
...
...
@@ -377,6 +362,21 @@ def render_html_view(request, user_id, course_id):
# Append/Override the existing view context values with request-time values
_update_certificate_context
(
context
,
course
,
user
,
user_certificate
)
# If enabled, show the LinkedIn "add to profile" button
# Clicking this button sends the user to LinkedIn where they
# can add the certificate information to their profile.
linkedin_config
=
LinkedInAddToProfileConfiguration
.
current
()
if
linkedin_config
.
enabled
:
context
[
'linked_in_url'
]
=
linkedin_config
.
add_to_profile_url
(
course
.
id
,
course
.
display_name
,
user_certificate
.
mode
,
request
.
build_absolute_uri
(
get_certificate_url
(
user_id
=
user
.
id
,
course_id
=
unicode
(
course
.
id
)
))
)
# Microsites will need to be able to override any hard coded
# content that was put into the context in the
# _update_certificate_context() call above. For example the
...
...
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