self.assertContains(response,'<td>user does not exist, enrollment allowed, pending with auto enrollment on, email sent</td>')
#Check the outbox
self.assertEqual(len(mail.outbox),3)
self.assertEqual(mail.outbox[0].subject,'You have been enrolled in MITx/999/Robot_Super_Course')
self.assertEqual(mail.outbox[1].subject,'You have been invited to register for MITx/999/Robot_Super_Course')
self.assertEqual(mail.outbox[1].body,"Dear student,\n\nYou have been invited to join MITx/999/Robot_Super_Course at edx.org by a member of the course staff.\n\n"+
"To finish your registration, please visit https://edx.org/register and fill out the registration form.\n"+
"Once you have registered and activated your account, you will see MITx/999/Robot_Super_Course listed on your dashboard.\n\n"+
"----\nThis email was automatically sent from edx.org to student3_1@test.com")
self.assertEqual(mail.outbox[0].subject,'You have been un-enrolled from MITx/999/Robot_Super_Course')
self.assertEqual(mail.outbox[0].body,"Dear Student,\n\nYou have been un-enrolled from course MITx/999/Robot_Super_Course by a member of the course staff. "+
"Please disregard the invitation previously sent.\n\n"+
"----\nThis email was automatically sent from edx.org to student4_0@test.com")
self.assertEqual(mail.outbox[1].subject,'You have been un-enrolled from MITx/999/Robot_Super_Course')
You have been un-enrolled in ${course_id} at ${site_name} by a member of the course staff. The course will no longer appear on your ${site_name} dashboard.
Your other courses have not been affected.
----
This email was automatically sent from ${site_name} to ${first_name} ${last_name}