'Test whether get_problem_responses returns an appropriate status
message if CSV generation is already in progress.'

@valid_problem_location
def test_get_problem_responses_already_running(self):

    url = reverse('get_problem_responses', kwargs={'course_id': unicode(self.course.id)})
    task_type = 'problem_responses_csv'
    already_running_status = generate_already_running_error_message(task_type)
    with patch('lms.djangoapps.instructor_task.api.submit_calculate_problem_responses_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)
