Merge pull request #10561 from edx/release
Verify patched fix merge back into master.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user