'Decorator for tests that target get_problem_responses endpoint and
need to pretend user submitted a valid problem location.'

def valid_problem_location(test):

    @functools.wraps(test)
    def wrapper(self, *args, **kwargs):
        '\n                                                Run    `test`    method,    ensuring    that    UsageKey.from_string    returns    a\n                                                problem    key    that    the    get_problem_responses    endpoint    can\n                                                work    with.\n                                                '
        mock_problem_key = Mock(return_value=u'')
        mock_problem_key.course_key = self.course.id
        with patch.object(UsageKey, 'from_string') as patched_method:
            patched_method.return_value = mock_problem_key
            test(self, *args, **kwargs)
    return wrapper
