From 57f46db09f991f1fc3b78057088cc242e0940f6a Mon Sep 17 00:00:00 2001 From: PIG208 <359101898@qq.com> Date: Mon, 26 Jul 2021 23:13:43 +0800 Subject: [PATCH] tests: Pass HostRequestMock to export_realm. `export_realm` accepts an HttpRequest as the first argument, while `self.client_post` conflicts with it. Though the argument is unused in `export_realm`, we keep it to be compliant with the view function type. --- zerver/tests/test_realm_export.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_realm_export.py b/zerver/tests/test_realm_export.py index ca40edf8f7..29b33717cc 100644 --- a/zerver/tests/test_realm_export.py +++ b/zerver/tests/test_realm_export.py @@ -10,6 +10,7 @@ from analytics.models import RealmCount from zerver.lib.exceptions import JsonableError from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_helpers import ( + HostRequestMock, create_dummy_file, create_s3_buckets, stdout_suppressed, @@ -33,7 +34,7 @@ class RealmExportTest(ZulipTestCase): user = self.example_user("hamlet") self.login_user(user) with self.assertRaises(JsonableError): - export_realm(self.client_post, user) + export_realm(HostRequestMock(), user) @use_s3_backend def test_endpoint_s3(self) -> None: @@ -195,7 +196,7 @@ class RealmExportTest(ZulipTestCase): RealmAuditLog.objects.bulk_create(exports) with self.assertRaises(JsonableError) as error: - export_realm(self.client_post, admin) + export_realm(HostRequestMock(), admin) self.assertEqual(str(error.exception), "Exceeded rate limit.") def test_upload_and_message_limit(self) -> None: