def test_optout_row_created_on_signal(self): """ Make sure the correct row is created for a user enrolled in a course """ force_optout_all(sender=self.__class__, user=self.student) self.assertEqual( Optout.objects.filter(user=self.student, course_id=self.course.id).count(), 1)
def test_optout_course(self): """ Make sure student does not receive course email after being opted out """ # Use the signal receiver to for the opt-out force_optout_all(sender=self.__class__, user=self.student) # Try to send a bulk course email self.client.login(username=self.instructor.username, password="******") self.send_test_email() # Assert that self.student.email not in mail.to, outbox should only contain "myself" target self.assertEqual(len(mail.outbox), 1) self.assertEqual(len(mail.outbox[0].to), 1) self.assertEqual(mail.outbox[0].to[0], self.instructor.email)
def test_optout_row_created_on_signal(self): """ Make sure the correct row is created for a user enrolled in a course """ force_optout_all(sender=self.__class__, user=self.student) self.assertEqual(Optout.objects.filter(user=self.student, course_id=self.course.id).count(), 1)