(url, data, user, method="POST", rmeta={})
return request
Make a fake request; defaults to POST.
Make a fake request; defaults to POST.
Make a fake request ; defaults to POST .
def fake_request(url, data, user, method="POST", rmeta={}):
    "Make a fake request; defaults to POST."

    methods = {"POST": RequestFactory().post, "GET": RequestFactory().get,
               'PUT': RequestFactory().put}

    assert method in methods

    request = methods[method](url, data)

    # Mimic messaging system
    request.session = {}
    messages = fallback.FallbackStorage(request=request)
    request._messages = messages

    # Update the META info
    request.META.update(rmeta)

    request.user = user

    return request
def fake_request ( url , data , user , method = "POST" , rmeta = { } ) : methods = { "POST" : RequestFactory ( ) . post , "GET" : RequestFactory ( ) . get , 'PUT' : RequestFactory ( ) . put } assert method in methods request = methods [ method ] ( url , data ) # Mimic messaging system request . session = { } messages = fallback . FallbackStorage ( request = request ) request . _messages = messages # Update the META info request . META . update ( rmeta ) request . user = user return request