support: Add database query test of single realm and remote realm views.

Gives a baseline of current database queries for these single realm
or remote realm support views, so that as we add features to these
views, we can better manage how those changes impact the performance
of our support views in general.
This commit is contained in:
Lauryn Menard 2024-08-23 22:51:47 +02:00 committed by Tim Abbott
parent ed63a40184
commit 349954e4fc
1 changed files with 14 additions and 0 deletions

View File

@ -170,6 +170,13 @@ class TestRemoteServerSupportEndpoint(ZulipTestCase):
remote_server=remote_realm.server, email="server-admin@example.com"
)
def test_remote_support_view_queries(self) -> None:
iago = self.example_user("iago")
self.login_user(iago)
with self.assert_database_query_count(28):
result = self.client_get("/activity/remote/support", {"q": "zulip-3.example.com"})
self.assertEqual(result.status_code, 200)
def test_search(self) -> None:
def assert_server_details_in_response(
html_response: "TestHttpResponse", hostname: str
@ -737,6 +744,13 @@ class TestSupportEndpoint(ZulipTestCase):
)
return customer
def test_realm_support_view_queries(self) -> None:
iago = self.example_user("iago")
self.login_user(iago)
with self.assert_database_query_count(16):
result = self.client_get("/activity/support", {"q": "zulip"}, subdomain="zulip")
self.assertEqual(result.status_code, 200)
def test_search(self) -> None:
reset_email_visibility_to_everyone_in_zulip_realm()
lear_user = self.lear_user("king")