This mock allows you to make requests against a view that isn’t included in any URLConf.
Usage:
rf = RequestFactory()
get_request = rf.get('/hello/')
post_request = rf.post('/submit/', {'foo': 'bar'})
This class re-uses the django.test.client.Client interface, docs here: http://www.djangoproject.com/documentation/testing/#the-test-client
Once you have a request object you can pass it to any view function, just as if that view had been hooked up using a URLconf.
Taken from Djangosnippets.net, originally by Simon Willison.