2👍
✅
You can instantiate HttpRequest and use it as a regular request in your test:
fake_request = HttpRequest()
fake_request.user = AnonymousUser()
fake_request.META['SERVER_NAME'] = site.domain
fake_request.META['SERVER_PORT'] = 80
s = SessionStore()
s.create()
fake_request.session = s
In your case you might need to fill more fields
Source:stackexchange.com