About RequestFactory in Django Tests
In Django tests when you use RequestFactory
to create fake requests, you can pass extra META parameters to the get()
, post()
, etc. methods as additional keyword arguments.
For example to pass a custom user agent you would do this:
1 2 3 4 5 6 |
|
Tips and Tricks Programming Testing Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.