profile_request: Replace MockRequest with HostRequestMock.

Since previously we use a custom mock request that doesn't inherit
HttpRequest, there are some typing problems when we use it.
This commit is contained in:
PIG208
2021-08-19 00:42:39 +08:00
committed by Tim Abbott
parent 460119986b
commit bb36bd8b6b
2 changed files with 20 additions and 28 deletions

View File

@@ -297,6 +297,7 @@ class HostRequestMock(HttpRequest):
client_name: Optional[str] = None,
meta_data: Optional[Dict[str, Any]] = None,
tornado_handler: Optional[AsyncDjangoHandler] = DummyHandler(),
path: str = "",
) -> None:
self.host = host
self.GET = QueryDict(mutable=True)
@@ -315,7 +316,7 @@ class HostRequestMock(HttpRequest):
self.META = {"PATH_INFO": "test"}
else:
self.META = meta_data
self.path = ""
self.path = path
self.user = user_profile
self._body = b""
self.content_type = ""