mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
test_helpers: Include an empty session for HostRequestMock.
This allows code that expects request.session to exist to not crash.
This commit is contained in:
@@ -19,6 +19,7 @@ import ldap
|
||||
import orjson
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.db.migrations.state import StateApps
|
||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||
from django.http.request import QueryDict
|
||||
@@ -397,6 +398,7 @@ class HostRequestMock(HttpRequest):
|
||||
self.user = user_profile or AnonymousUser()
|
||||
self._body = orjson.dumps(post_data)
|
||||
self.content_type = ""
|
||||
self.session = SessionBase()
|
||||
|
||||
RequestNotes.set_notes(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user