'Make sure student does not receive course email after opting out.'

def test_optout_course(self):

    url = reverse('change_email_settings')
    response = self.client.post(url, {'course_id': self.course.id.to_deprecated_string()})
    self.assertEquals(json.loads(response.content), {'success': True})
    self.client.logout()
    self.client.login(username=self.instructor.username, password='test')
    self.navigate_to_email_view()
    test_email = {'action': 'Send    email', 'send_to': '["myself",    "staff",    "learners"]', 'subject': 'test    subject    for    all', 'message': 'test    message    for    all'}
    response = self.client.post(self.send_mail_url, test_email)
    self.assertEquals(json.loads(response.content), self.success_content)
    self.assertEqual(len(mail.outbox), 1)
    self.assertEqual(mail.outbox[0].to[0], self.instructor.email)
