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
e1573211
Commit
e1573211
authored
Aug 26, 2015
by
Amir Qayyum Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed CCX display name issue in enrollment/unenrollment email templates for non EDX members
parent
c217d986
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
30 deletions
+74
-30
lms/djangoapps/instructor/tests/test_enrollment.py
+65
-23
lms/templates/emails/enroll_email_allowedmessage.txt
+3
-3
lms/templates/emails/enroll_email_allowedsubject.txt
+2
-1
lms/templates/emails/unenroll_email_allowedmessage.txt
+1
-1
lms/templates/emails/unenroll_email_enrolledmessage.txt
+1
-1
lms/templates/emails/unenroll_email_subject.txt
+2
-1
No files found.
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
e1573211
...
...
@@ -37,9 +37,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from
submissions
import
api
as
sub_api
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.tests.django_utils
import
(
ModuleStoreTestCase
,
SharedModuleStoreTestCase
,
TEST_DATA_SPLIT_MODULESTORE
)
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
,
TEST_DATA_SPLIT_MODULESTORE
@attr
(
'shard_1'
)
...
...
@@ -576,23 +574,27 @@ class TestSendBetaRoleEmail(TestCase):
@attr
(
'shard_1'
)
class
TestGetEmailParamsCCX
(
ModuleStoreTestCase
):
class
TestGetEmailParamsCCX
(
Shared
ModuleStoreTestCase
):
"""
Test what URLs the function get_email_params for CCX student enrollment.
"""
MODULESTORE
=
TEST_DATA_SPLIT_MODULESTORE
@classmethod
def
setUpClass
(
cls
):
super
(
TestGetEmailParamsCCX
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
setUp
(
self
):
super
(
TestGetEmailParamsCCX
,
self
)
.
setUp
()
self
.
course
=
CourseFactory
.
create
()
self
.
coach
=
AdminFactory
.
create
()
role
=
CourseCcxCoachRole
(
self
.
course
.
id
)
role
.
add_users
(
self
.
coach
)
self
.
ccx
=
CcxFactory
(
course_id
=
self
.
course
.
id
,
coach
=
self
.
coach
)
self
.
course_key
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
self
.
ccx
.
id
)
# Explicitly construct what we expect the course URLs to be
site
=
settings
.
SITE_NAME
self
.
course_url
=
u'https://{}/courses/{}/'
.
format
(
...
...
@@ -600,9 +602,7 @@ class TestGetEmailParamsCCX(ModuleStoreTestCase):
self
.
course_key
)
self
.
course_about_url
=
self
.
course_url
+
'about'
self
.
registration_url
=
u'https://{}/register'
.
format
(
site
,
)
self
.
registration_url
=
u'https://{}/register'
.
format
(
site
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
test_ccx_enrollment_email_params
(
self
):
...
...
@@ -683,10 +683,14 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
cls
.
subject_template
=
'emails/enroll_email_allowedsubject.txt'
cls
.
message_template
=
'emails/enroll_email_allowedmessage.txt'
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
setUp
(
self
):
super
(
TestRenderMessageToString
,
self
)
.
setUp
()
self
.
course_key
=
None
self
.
ccx
=
None
coach
=
AdminFactory
.
create
()
role
=
CourseCcxCoachRole
(
self
.
course
.
id
)
role
.
add_users
(
coach
)
self
.
ccx
=
CcxFactory
(
course_id
=
self
.
course
.
id
,
coach
=
coach
)
self
.
course_key
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
self
.
ccx
.
id
)
def
get_email_params
(
self
):
"""
...
...
@@ -702,12 +706,6 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
"""
Returns a dictionary of parameters used to render an email for CCX.
"""
coach
=
AdminFactory
.
create
()
role
=
CourseCcxCoachRole
(
self
.
course
.
id
)
role
.
add_users
(
coach
)
self
.
ccx
=
CcxFactory
(
course_id
=
self
.
course
.
id
,
coach
=
coach
)
self
.
course_key
=
CCXLocator
.
from_course_locator
(
self
.
course
.
id
,
self
.
ccx
.
id
)
email_params
=
get_email_params
(
self
.
course
,
True
,
...
...
@@ -730,12 +728,10 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
language
=
language
)
def
get_subject_and_message_ccx
(
self
):
def
get_subject_and_message_ccx
(
self
,
subject_template
,
message_template
):
"""
Returns the subject and message rendered in the specified language for CCX.
"""
subject_template
=
'emails/enroll_email_enrolledsubject.txt'
message_template
=
'emails/enroll_email_enrolledmessage.txt'
return
render_message_to_string
(
subject_template
,
message_template
,
...
...
@@ -758,11 +754,15 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
self
.
assertIn
(
"You have been"
,
message
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
test_render_
message_ccx
(
self
):
def
test_render_
enrollment_message_ccx_members
(
self
):
"""
Test email template renders for CCX.
Test enrollment email template renders for CCX.
For EDX members.
"""
subject
,
message
=
self
.
get_subject_and_message_ccx
()
subject_template
=
'emails/enroll_email_enrolledsubject.txt'
message_template
=
'emails/enroll_email_enrolledmessage.txt'
subject
,
message
=
self
.
get_subject_and_message_ccx
(
subject_template
,
message_template
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
subject
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
message
)
site
=
settings
.
SITE_NAME
...
...
@@ -771,3 +771,45 @@ class TestRenderMessageToString(SharedModuleStoreTestCase):
self
.
course_key
)
self
.
assertIn
(
course_url
,
message
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
test_render_unenrollment_message_ccx_members
(
self
):
"""
Test unenrollment email template renders for CCX.
For EDX members.
"""
subject_template
=
'emails/unenroll_email_subject.txt'
message_template
=
'emails/unenroll_email_enrolledmessage.txt'
subject
,
message
=
self
.
get_subject_and_message_ccx
(
subject_template
,
message_template
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
subject
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
message
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
test_render_enrollment_message_ccx_non_members
(
self
):
"""
Test enrollment email template renders for CCX.
For non EDX members.
"""
subject_template
=
'emails/enroll_email_allowedsubject.txt'
message_template
=
'emails/enroll_email_allowedmessage.txt'
subject
,
message
=
self
.
get_subject_and_message_ccx
(
subject_template
,
message_template
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
subject
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
message
)
site
=
settings
.
SITE_NAME
registration_url
=
u'https://{}/register'
.
format
(
site
)
self
.
assertIn
(
registration_url
,
message
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'CUSTOM_COURSES_EDX'
:
True
})
def
test_render_unenrollment_message_ccx_non_members
(
self
):
"""
Test unenrollment email template renders for CCX.
For non EDX members.
"""
subject_template
=
'emails/unenroll_email_subject.txt'
message_template
=
'emails/unenroll_email_allowedmessage.txt'
subject
,
message
=
self
.
get_subject_and_message_ccx
(
subject_template
,
message_template
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
subject
)
self
.
assertIn
(
self
.
ccx
.
display_name
,
message
)
lms/templates/emails/enroll_email_allowedmessage.txt
View file @
e1573211
...
...
@@ -4,7 +4,7 @@ ${_("Dear student,")}
${_("You have been invited to join {course_name} at {site_name} by a "
"member of the course staff.").format(
course_name=course.display_name_with_default,
course_name=
display_name or
course.display_name_with_default,
site_name=site_name
)}
% if is_shib_course:
...
...
@@ -26,13 +26,13 @@ ${_("To finish your registration, please visit {registration_url} and fill "
% if auto_enroll:
${_("Once you have registered and activated your account, you will see "
"{course_name} listed on your dashboard.").format(
course_name=course.display_name_with_default
course_name=
display_name or
course.display_name_with_default
)}
% elif course_about_url is not None:
${_("Once you have registered and activated your account, visit {course_about_url} "
"to join the course.").format(course_about_url=course_about_url)}
% else:
${_("You can then enroll in {course_name}.").format(course_name=course.display_name_with_default)}
${_("You can then enroll in {course_name}.").format(course_name=
display_name or
course.display_name_with_default)}
% endif
% endif
...
...
lms/templates/emails/enroll_email_allowedsubject.txt
View file @
e1573211
<%! from django.utils.translation import ugettext as _ %>
${_("You have been invited to register for {course_name}").format(
course_name=course.display_name_with_default
course_name=
display_name or
course.display_name_with_default
)}
\ No newline at end of file
lms/templates/emails/unenroll_email_allowedmessage.txt
View file @
e1573211
...
...
@@ -4,7 +4,7 @@ ${_("Dear Student,")}
${_("You have been un-enrolled from course {course_name} by a member "
"of the course staff. Please disregard the invitation "
"previously sent.").format(course_name=course.display_name_with_default)}
"previously sent.").format(course_name=
display_name or
course.display_name_with_default)}
----
${_("This email was automatically sent from {site_name} "
...
...
lms/templates/emails/unenroll_email_enrolledmessage.txt
View file @
e1573211
...
...
@@ -5,7 +5,7 @@ ${_("Dear {full_name}").format(full_name=full_name)}
${_("You have been un-enrolled in {course_name} at {site_name} by a member "
"of the course staff. The course will no longer appear on your "
"{site_name} dashboard.").format(
course_name=course.display_name_with_default, site_name=site_name
course_name=
display_name or
course.display_name_with_default, site_name=site_name
)}
${_("Your other courses have not been affected.")}
...
...
lms/templates/emails/unenroll_email_subject.txt
View file @
e1573211
<%! from django.utils.translation import ugettext as _ %>
${_("You have been un-enrolled from {course_name}").format(
course_name=course.display_name_with_default
course_name=
display_name or
course.display_name_with_default
)}
\ No newline at end of file
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