'Tests retries when the email doesn\'t exist'

@patch('bulk_email.tasks.SubtaskStatus.increment')
@patch('bulk_email.tasks.log')
def test_nonexistent_email(self, mock_log, result):

    course_id = self.course.id
    entry = InstructorTask.create(course_id, 'task_type', 'task_key', 'task_input', self.instructor)
    task_input = {'email_id': (-1)}
    with self.assertRaises(CourseEmail.DoesNotExist):
        perform_delegate_email_batches(entry.id, course_id, task_input, 'action_name')
    ((log_str, __, email_id), __) = mock_log.warning.call_args
    self.assertTrue(mock_log.warning.called)
    self.assertIn('Failed    to    get    CourseEmail    with    id', log_str)
    self.assertEqual(email_id, (-1))
    self.assertFalse(result.called)
