Commit d408f174 by Sarina Canelake

Wording for batch beta email add with autoenroll (LMS-2551)

parent 19b6718c
...@@ -845,6 +845,48 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe ...@@ -845,6 +845,48 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
) )
) )
def test_add_notenrolled_with_email_autoenroll(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
response = self.client.get(
url,
{'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': True, 'auto_enroll': True}
)
self.assertEqual(response.status_code, 200)
self.assertTrue(CourseBetaTesterRole(self.course.location).has_user(self.notenrolled_student))
# test the response data
expected = {
"action": "add",
"results": [
{
"identifier": self.notenrolled_student.email,
"error": False,
"userDoesNotExist": False
}
]
}
res_json = json.loads(response.content)
self.assertEqual(res_json, expected)
# Check the outbox
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(
mail.outbox[0].subject,
'You have been invited to a beta test for Robot Super Course'
)
self.assertEqual(
mail.outbox[0].body,
u"Dear {0}\n\nYou have been invited to be a beta tester "
"for Robot Super Course at edx.org by a member of the course staff.\n\n"
"To start accessing course materials, please visit "
"https://edx.org/courses/MITx/999/Robot_Super_Course/\n\n----\n"
"This email was automatically sent from edx.org to {1}".format(
self.notenrolled_student.profile.name,
self.notenrolled_student.email
)
)
def test_add_notenrolled_email_mktgsite(self): def test_add_notenrolled_email_mktgsite(self):
url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id}) url = reverse('bulk_beta_modify_access', kwargs={'course_id': self.course.id})
# Try with marketing site enabled # Try with marketing site enabled
......
...@@ -342,7 +342,7 @@ def bulk_beta_modify_access(request, course_id): ...@@ -342,7 +342,7 @@ def bulk_beta_modify_access(request, course_id):
email_params = {} email_params = {}
if email_students: if email_students:
email_params = get_email_params(course, auto_enroll=False) email_params = get_email_params(course, auto_enroll=auto_enroll)
for identifier in identifiers: for identifier in identifiers:
try: try:
......
...@@ -8,7 +8,11 @@ ${_("You have been invited to be a beta tester for {course_name} at {site_name} ...@@ -8,7 +8,11 @@ ${_("You have been invited to be a beta tester for {course_name} at {site_name}
site_name=site_name site_name=site_name
)} )}
% if course_about_url is not None: % if auto_enroll:
${_("To start accessing course materials, please visit {course_url}").format(
course_url=course_url
)}
% elif course_about_url is not None:
${_("Visit {course_about_url} to join the course and begin the beta test.").format(course_about_url=course_about_url)} ${_("Visit {course_about_url} to join the course and begin the beta test.").format(course_about_url=course_about_url)}
% else: % else:
${_("Visit {site_name} to enroll in the course and begin the beta test.").format(site_name=site_name)} ${_("Visit {site_name} to enroll in the course and begin the beta test.").format(site_name=site_name)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment