mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
tests: Replace HttpResponse with TestHttpResponse.
Since `HttpResponse` is an inaccurate representation of the monkey-patched response object returned by the Django test client, we replace it with `_MonkeyPatchedWSGIResponse` as `TestHttpResponse`. This replaces `HttpResponse` in zerver/tests, analytics/tests, coporate/tests, zerver/lib/test_classes.py, and zerver/lib/test_helpers.py with `TestHttpResponse`. Several files in zerver/tests are excluded from this substitution. This commit is auto-generated by a script, with manual adjustments on certain files squashed into it. This is a part of the django-stubs refactorings. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
3e11066f9f
commit
426f8ce385
@@ -2,7 +2,7 @@ import hashlib
|
||||
import random
|
||||
from datetime import timedelta
|
||||
from io import StringIO
|
||||
from typing import Any, Dict, List, Mapping, Optional, Sequence, Set, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Sequence, Set, Union
|
||||
from unittest import mock
|
||||
|
||||
import orjson
|
||||
@@ -105,6 +105,9 @@ from zerver.models import (
|
||||
)
|
||||
from zerver.views.streams import compose_views
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||
|
||||
|
||||
class TestMiscStuff(ZulipTestCase):
|
||||
def test_test_helper(self) -> None:
|
||||
@@ -2378,7 +2381,7 @@ class StreamAdminTest(ZulipTestCase):
|
||||
target_users_subbed: bool = True,
|
||||
using_legacy_emails: bool = False,
|
||||
other_sub_users: Sequence[UserProfile] = [],
|
||||
) -> HttpResponse:
|
||||
) -> "TestHttpResponse":
|
||||
|
||||
# Set up the main user, who is in most cases an admin.
|
||||
if is_realm_admin:
|
||||
@@ -5676,7 +5679,7 @@ class GetSubscribersTest(ZulipTestCase):
|
||||
|
||||
def make_subscriber_request(
|
||||
self, stream_id: int, user: Optional[UserProfile] = None
|
||||
) -> HttpResponse:
|
||||
) -> "TestHttpResponse":
|
||||
if user is None:
|
||||
user = self.user_profile
|
||||
return self.api_get(user, f"/api/v1/streams/{stream_id}/members")
|
||||
|
||||
Reference in New Issue
Block a user