'Test whether get_students_who_may_enroll returns an appropriate
status message when users request a CSV file of students who
may enroll in a course.'

def test_get_students_who_may_enroll(self):

    url = reverse('get_students_who_may_enroll', kwargs={'course_id': unicode(self.course.id)})
    response = self.client.post(url, {})
    self.assertEqual(response.status_code, 200)
    task_type = 'may_enroll_info_csv'
    already_running_status = generate_already_running_error_message(task_type)
    with patch('lms.djangoapps.instructor_task.api.submit_calculate_may_enroll_csv') as submit_task_function:
        error = AlreadyRunningError(already_running_status)
        submit_task_function.side_effect = error
        response = self.client.post(url, {})
    self.assertEqual(response.status_code, 400)
    self.assertIn(already_running_status, response.content)
