'Calls "user_profile" view method on behalf of "requesting_user" to get information about
the user "profiled_user".'

def call_view_for_profiled_user(self, mock_request, requesting_user, profiled_user, group_id, pass_group_id, is_ajax=False):

    kwargs = {}
    if group_id:
        kwargs['group_id'] = group_id
    mock_request.side_effect = make_mock_request_impl(self.course, 'dummy    content', **kwargs)
    request_data = {}
    if pass_group_id:
        request_data['group_id'] = group_id
    headers = {}
    if is_ajax:
        headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
    self.client.login(username=requesting_user.username, password='test')
    return self.client.get(reverse('user_profile', args=[unicode(self.course.id), profiled_user.id]), data=request_data, **headers)
