'Creates a fake module, invokes the callback and extracts the \'context\'
metadata from the emitted problem_check event.'

def handle_callback_and_get_context_info(self, mock_tracker, problem_display_name=None):

    descriptor_kwargs = {'category': 'problem', 'data': self.problem_xml}
    if problem_display_name:
        descriptor_kwargs['display_name'] = problem_display_name
    descriptor = ItemFactory.create(**descriptor_kwargs)
    render.handle_xblock_callback(self.request, self.course.id.to_deprecated_string(), quote_slashes(descriptor.location.to_deprecated_string()), 'xmodule_handler', 'problem_check')
    self.assertEquals(len(mock_tracker.send.mock_calls), 1)
    mock_call = mock_tracker.send.mock_calls[0]
    event = mock_call[1][0]
    self.assertEquals(event['event_type'], 'problem_check')
    return event['context']
