@@ -1316,50 +1316,7 @@ def test_enroll_with_email_not_registered(self, protocol):
13161316
13171317 assert 'Once you have registered and activated your account,' in body
13181318
1319- assert '{proto}://{site}{about_path}' .format ( # noqa: UP032
1320- proto = protocol ,
1321- site = self .site_name ,
1322- about_path = self .about_path
1323- ) in body
1324-
1325- assert 'This email was automatically sent from edx.org to robot-not-an-email-yet@robot.org' in body
1326-
1327- @ddt .data ('http' , 'https' )
1328- @patch .dict (settings .FEATURES , {'ENABLE_MKTG_SITE' : True })
1329- def test_enroll_email_not_registered_mktgsite (self , protocol ):
1330- url = reverse ('students_update_enrollment' , kwargs = {'course_id' : str (self .course .id )})
1331- params = {'identifiers' : self .notregistered_email , 'action' : 'enroll' , 'email_students' : True }
1332- environ = {'wsgi.url_scheme' : protocol }
1333- response = self .client .post (url , params , ** environ )
1334-
1335- manual_enrollments = ManualEnrollmentAudit .objects .all ()
1336- assert manual_enrollments .count () == 1
1337- assert manual_enrollments [0 ].state_transition == UNENROLLED_TO_ALLOWEDTOENROLL
1338- assert response .status_code == 200
1339-
1340- text_body = mail .outbox [0 ].body
1341- html_body = mail .outbox [0 ].alternatives [0 ][0 ]
1342-
1343- assert text_body .startswith ('Dear student,' )
1344- assert 'To finish your registration, please visit' in text_body
1345- assert 'Please finish your registration and fill' in html_body
1346-
1347- for body in [text_body , html_body ]:
1348- assert 'You have been invited to join {display_name} at edx.org by a member of the course staff.' .format ( # noqa: UP032 # pylint: disable=line-too-long
1349- display_name = self .course .display_name
1350- ) in body
1351-
1352- assert '{proto}://{site}/register' .format ( # noqa: UP032
1353- proto = protocol ,
1354- site = self .site_name
1355- ) in body
1356-
1357- assert ('fill out the registration form making sure to use '
1358- 'robot-not-an-email-yet@robot.org in the Email field' ) in body
1359-
1360- assert 'You can then enroll in {display_name}.' .format ( # noqa: UP032
1361- display_name = self .course .display_name
1362- ) in body
1319+ assert f'{ settings .LMS_ROOT_URL } { self .about_path } ' in body
13631320
13641321 assert 'This email was automatically sent from edx.org to robot-not-an-email-yet@robot.org' in body
13651322
@@ -1587,11 +1544,7 @@ def test_enroll_with_email_not_registered_with_shib(self, protocol, mock_uses_sh
15871544
15881545 text_body = mail .outbox [0 ].body
15891546 html_body = mail .outbox [0 ].alternatives [0 ][0 ]
1590- course_url = '{proto}://{site}{about_path}' .format ( # noqa: UP032
1591- proto = protocol ,
1592- site = self .site_name ,
1593- about_path = self .about_path ,
1594- )
1547+ course_url = f'{ settings .LMS_ROOT_URL } { self .about_path } '
15951548 assert text_body .startswith ('Dear student,' )
15961549 assert 'To access this course visit {course_url} and register for this course.' .format ( # noqa: UP032
15971550 course_url = course_url ,
@@ -1606,31 +1559,6 @@ def test_enroll_with_email_not_registered_with_shib(self, protocol, mock_uses_sh
16061559
16071560 assert 'This email was automatically sent from edx.org to robot-not-an-email-yet@robot.org' in body
16081561
1609- @patch ('lms.djangoapps.instructor.enrollment.uses_shib' )
1610- @patch .dict (settings .FEATURES , {'ENABLE_MKTG_SITE' : True })
1611- def test_enroll_email_not_registered_shib_mktgsite (self , mock_uses_shib ):
1612- # Try with marketing site enabled and shib on
1613- mock_uses_shib .return_value = True
1614-
1615- url = reverse ('students_update_enrollment' , kwargs = {'course_id' : str (self .course .id )})
1616- # Try with marketing site enabled
1617- with patch .dict ('django.conf.settings.FEATURES' , {'ENABLE_MKTG_SITE' : True }):
1618- response = self .client .post (url , {'identifiers' : self .notregistered_email , 'action' : 'enroll' ,
1619- 'email_students' : True })
1620-
1621- assert response .status_code == 200
1622-
1623- text_body = mail .outbox [0 ].body
1624- html_body = mail .outbox [0 ].alternatives [0 ][0 ]
1625- assert text_body .startswith ('Dear student,' )
1626-
1627- for body in [text_body , html_body ]:
1628- assert 'You have been invited to join {display_name} at edx.org by a member of the course staff.' .format ( # noqa: UP032 # pylint: disable=line-too-long
1629- display_name = self .course .display_name ,
1630- ) in body
1631-
1632- assert 'This email was automatically sent from edx.org to robot-not-an-email-yet@robot.org' in body
1633-
16341562 @ddt .data ('http' , 'https' )
16351563 @patch ('lms.djangoapps.instructor.enrollment.uses_shib' )
16361564 def test_enroll_with_email_not_registered_with_shib_autoenroll (self , protocol , mock_uses_shib ):
@@ -2270,11 +2198,7 @@ def test_add_notenrolled_with_email(self, protocol):
22702198 assert 'by a member of the course staff.' in body
22712199 assert 'enroll in this course and begin the beta test' in body
22722200
2273- assert '{proto}://{site}{about_path}' .format ( # noqa: UP032
2274- proto = protocol ,
2275- site = self .site_name ,
2276- about_path = self .about_path ,
2277- ) in body
2201+ assert f'{ settings .LMS_ROOT_URL } { self .about_path } ' in body
22782202
22792203 assert 'This email was automatically sent from edx.org to {student_email}' .format ( # noqa: UP032
22802204 student_email = self .notenrolled_student .email ,
@@ -2332,31 +2256,6 @@ def test_add_notenrolled_with_email_autoenroll(self, protocol):
23322256 student_email = self .notenrolled_student .email ,
23332257 ) in body
23342258
2335- @patch .dict (settings .FEATURES , {'ENABLE_MKTG_SITE' : True })
2336- def test_add_notenrolled_email_mktgsite (self ):
2337- # Try with marketing site enabled
2338- url = reverse ('bulk_beta_modify_access' , kwargs = {'course_id' : str (self .course .id )})
2339- response = self .client .post (url , {'identifiers' : self .notenrolled_student .email , 'action' : 'add' , 'email_students' : True }) # pylint: disable=line-too-long
2340-
2341- assert response .status_code == 200
2342-
2343- text_body = mail .outbox [0 ].body
2344- html_body = mail .outbox [0 ].alternatives [0 ][0 ]
2345- student_name = self .notenrolled_student .profile .name
2346- assert text_body .startswith (f'Dear { student_name } ' )
2347-
2348- for body in [text_body , html_body ]:
2349- assert 'You have been invited to be a beta tester for {display_name} at edx.org' .format ( # noqa: UP032
2350- display_name = self .course .display_name ,
2351- ) in body
2352-
2353- assert 'by a member of the course staff.' in body
2354- assert 'Visit edx.org' in body
2355- assert 'enroll in this course and begin the beta test' in body
2356- assert 'This email was automatically sent from edx.org to {student_email}' .format ( # noqa: UP032
2357- student_email = self .notenrolled_student .email ,
2358- ) in body
2359-
23602259 def test_enroll_with_email_not_registered (self ):
23612260 # User doesn't exist
23622261 url = reverse ('bulk_beta_modify_access' , kwargs = {'course_id' : str (self .course .id )})
0 commit comments