Skip to content

Commit

Permalink
fix: add missing function import in certificate template (openedx#33904
Browse files Browse the repository at this point in the history
…) (openedx#34171)

* fix: add missing function import in certificate template
* test: add test case to check certificates generated when GA4 is enabled

(cherry picked from commit d0a49d1)
  • Loading branch information
kaustavb12 authored Feb 5, 2024
1 parent e1c9e89 commit c270b4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 16 additions & 0 deletions lms/djangoapps/certificates/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,19 @@ def test_html_view_site_configuration_missing(self):
response,
'This should not survive being overwritten by static content',
)

@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED, GOOGLE_ANALYTICS_4_ID='GA-abc')
@with_site_configuration(configuration={'platform_name': 'My Platform Site'})
def test_html_view_with_g4(self):
test_url = get_certificate_url(
user_id=self.user.id,
course_id=str(self.course.id),
uuid=self.cert.verify_uuid
)
self._add_course_certificates(count=1, signatory_count=2)
response = self.client.get(test_url)
self.assertContains(
response,
'awarded this My Platform Site Honor Code Certificate of Completion',
)
self.assertContains(response, 'googletagmanager')
6 changes: 4 additions & 2 deletions lms/templates/certificates/accomplishment-base.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<%page expression_filter="h"/>
<%namespace name='static' file='/static_content.html'/>
<%! from django.utils.translation import gettext as _%>

<%!
from django.utils.translation import gettext as _
from openedx.core.djangolib.js_utils import js_escaped_string
%>
<%
# set doc language direction
from django.utils.translation import get_language_bidi
Expand Down

0 comments on commit c270b4f

Please sign in to comment.