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
ce99ca63
Commit
ce99ca63
authored
Nov 10, 2015
by
Cliff Dyer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10561 from edx/release
Verify patched fix merge back into master.
parents
31c5b945
3bd9f95a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
5 deletions
+99
-5
common/djangoapps/student/tests/test_certificates.py
+64
-0
common/djangoapps/student/views.py
+4
-1
lms/djangoapps/certificates/tests/test_webview_views.py
+25
-1
lms/djangoapps/certificates/views/webview.py
+4
-1
lms/templates/courseware/info.html
+1
-1
requirements/edx/github.txt
+1
-1
No files found.
common/djangoapps/student/tests/test_certificates.py
View file @
ce99ca63
...
...
@@ -2,6 +2,7 @@
import
unittest
import
ddt
import
mock
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
...
...
@@ -15,9 +16,18 @@ from certificates.tests.factories import GeneratedCertificateFactory # pylint:
from
certificates.api
import
get_certificate_url
# pylint: disable=import-error
from
course_modes.models
import
CourseMode
from
student.models
import
LinkedInAddToProfileConfiguration
# pylint: disable=no-member
def
_fake_is_request_in_microsite
():
"""
Mocked version of microsite helper method to always return true
"""
return
True
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CertificateDisplayTest
(
ModuleStoreTestCase
):
...
...
@@ -98,6 +108,60 @@ class CertificateDisplayTest(ModuleStoreTestCase):
self
.
assertContains
(
response
,
u'View Test_Certificate'
)
self
.
assertContains
(
response
,
test_url
)
def
test_post_to_linkedin_invisibility
(
self
):
"""
Verifies that the post certificate to linked button
does not appear by default (when config is not set)
"""
self
.
_create_certificate
(
'honor'
)
# until we set up the configuration, the LinkedIn action
# button should not be visible
self
.
_check_linkedin_visibility
(
False
)
def
test_post_to_linkedin_visibility
(
self
):
"""
Verifies that the post certificate to linked button appears
as expected
"""
self
.
_create_certificate
(
'honor'
)
config
=
LinkedInAddToProfileConfiguration
(
company_identifier
=
'0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9'
,
enabled
=
True
)
config
.
save
()
# now we should see it
self
.
_check_linkedin_visibility
(
True
)
@mock.patch
(
"microsite_configuration.microsite.is_request_in_microsite"
,
_fake_is_request_in_microsite
)
def
test_post_to_linkedin_microsite
(
self
):
"""
Verifies behavior for microsites which disables the post to LinkedIn
feature (for now)
"""
self
.
_create_certificate
(
'honor'
)
config
=
LinkedInAddToProfileConfiguration
(
company_identifier
=
'0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9'
,
enabled
=
True
)
config
.
save
()
# now we should not see it because we are in a microsite
self
.
_check_linkedin_visibility
(
False
)
def
_check_linkedin_visibility
(
self
,
is_visible
):
"""
Performs assertions on the Dashboard
"""
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
if
is_visible
:
self
.
assertContains
(
response
,
u'Add Certificate to LinkedIn Profile'
)
else
:
self
.
assertNotContains
(
response
,
u'Add Certificate to LinkedIn Profile'
)
def
_create_certificate
(
self
,
enrollment_mode
):
"""Simulate that the user has a generated certificate. """
CourseEnrollmentFactory
.
create
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
mode
=
enrollment_mode
)
...
...
common/djangoapps/student/views.py
View file @
ce99ca63
...
...
@@ -362,7 +362,10 @@ def _cert_info(user, course_overview, cert_status, course_mode): # pylint: disa
# 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
:
# posting certificates to LinkedIn is not currently
# supported in microsites/White Labels
if
linkedin_config
.
enabled
and
not
microsite
.
is_request_in_microsite
():
status_dict
[
'linked_in_url'
]
=
linkedin_config
.
add_to_profile_url
(
course_overview
.
id
,
course_overview
.
display_name
,
...
...
lms/djangoapps/certificates/tests/test_webview_views.py
View file @
ce99ca63
...
...
@@ -3,6 +3,7 @@
import
json
import
ddt
import
mock
from
uuid
import
uuid4
from
nose.plugins.attrib
import
attr
from
mock
import
patch
...
...
@@ -49,6 +50,13 @@ FEATURES_WITH_CUSTOM_CERTS_ENABLED = {
FEATURES_WITH_CUSTOM_CERTS_ENABLED
.
update
(
FEATURES_WITH_CERTS_ENABLED
)
def
_fake_is_request_in_microsite
():
"""
Mocked version of microsite helper method to always return true
"""
return
True
@attr
(
'shard_1'
)
@ddt.ddt
class
CertificatesViewsTests
(
ModuleStoreTestCase
,
EventTrackingTestCase
):
...
...
@@ -161,7 +169,23 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
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
)
self
.
assertIn
(
urllib
.
quote_plus
(
self
.
request
.
build_absolute_uri
(
test_url
)),
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
@mock.patch
(
"microsite_configuration.microsite.is_request_in_microsite"
,
_fake_is_request_in_microsite
)
def
test_linkedin_share_microsites
(
self
):
"""
Test: LinkedIn share URL should not be visible when called from within a microsite (for now)
"""
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
)
# the URL should not be present
self
.
assertNotIn
(
urllib
.
quote_plus
(
self
.
request
.
build_absolute_uri
(
test_url
)),
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_rendering_course_organization_data
(
self
):
...
...
lms/djangoapps/certificates/views/webview.py
View file @
ce99ca63
...
...
@@ -430,7 +430,10 @@ def render_html_view(request, user_id, course_id):
# 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
:
# posting certificates to LinkedIn is not currently
# supported in microsites/White Labels
if
linkedin_config
.
enabled
and
not
microsite
.
is_request_in_microsite
():
context
[
'linked_in_url'
]
=
linkedin_config
.
add_to_profile_url
(
course
.
id
,
course
.
display_name
,
...
...
lms/templates/courseware/info.html
View file @
ce99ca63
...
...
@@ -61,7 +61,7 @@ $(document).ready(function(){
${get_course_info_section(request, course, 'updates')}
</section>
<section
aria-label=
"${_('Handout Navigation')}"
class=
"handouts"
>
% if
SelfPacedConfiguration.current().enable_course_home_improvements
:
% if
False
:
<h1>
${_("Important Course Dates")}
</h1>
${get_course_date_summary(course, user)}
% endif
...
...
requirements/edx/github.txt
View file @
ce99ca63
...
...
@@ -61,7 +61,7 @@ git+https://github.com/edx/edx-reverification-block.git@0.0.4#egg=edx-reverifica
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
git+https://github.com/edx/edx-organizations.git@release-2015-09-22#egg=edx-organizations==0.1.6
git+https://github.com/edx/edx-proctoring.git@0.10.
16#egg=edx-proctoring==0.10.16
git+https://github.com/edx/edx-proctoring.git@0.10.
20#egg=edx-proctoring==0.10.20
# Third Party XBlocks
...
...
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