'Gets the request object for the view.
:param url: a mock url to use for the request
:param method: the http method to use for the request (\'get\', \'post\',
etc).'

def get_request(self, url, method=u'get', data=None, **kwargs):

    factory = RequestFactory()
    factory_func = getattr(factory, method)
    request = factory_func(url, data=(data or {}), **kwargs)
    return request
