Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

tests: Clean up tests for realm_domain and update_streams endpoint.

Gaurav Pandeydada7bb4bb93
diff --git a/zerver/tests/test_realm_domains.py b/zerver/tests/test_realm_domains.py
index d135764fc2a..bdbf4709331 100644
--- a/zerver/tests/test_realm_domains.py
+++ b/zerver/tests/test_realm_domains.py
@@ -26,14 +26,11 @@ class RealmDomainTest(ZulipTestCase):
RealmDomain.objects.create(realm=realm, domain="acme.com", allow_subdomains=True)
result = self.client_get("/json/realm/domains")
self.assert_json_success(result)
- received = orjson.dumps(result.json()["domains"], option=orjson.OPT_SORT_KEYS)
- expected = orjson.dumps(
- [
- {"domain": "zulip.com", "allow_subdomains": False},
- {"domain": "acme.com", "allow_subdomains": True},
- ],
- option=orjson.OPT_SORT_KEYS,
- )
+ received = result.json()["domains"]
+ expected = [
+ {"domain": "zulip.com", "allow_subdomains": False},
+ {"domain": "acme.com", "allow_subdomains": True},
+ ]
self.assertEqual(received, expected)
def test_not_realm_admin(self) -> None:
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index 83fb6963af4..5848e2a639d 100644
--- a/zerver/tests/test_subs.py
+++ b/zerver/tests/test_subs.py
@@ -715,7 +715,7 @@ class StreamAdminTest(ZulipTestCase):
stream_id = get_stream("private_stream", user_profile.realm).id
result = self.client_patch(
f"/json/streams/{stream_id}",
- {"description": orjson.dumps("Test description").decode()},
+ {"description": "Test description"},
)
self.assert_json_success(result)
# Should be just a description change event
@@ -939,7 +939,7 @@ class StreamAdminTest(ZulipTestCase):
result = self.client_patch(
f"/json/streams/{stream_id}",
- {"new_description": orjson.dumps("new description").decode()},
+ {"description": "new description"},
)
self.assert_json_success(result)
@@ -973,7 +973,7 @@ class StreamAdminTest(ZulipTestCase):
result = self.client_patch(
f"/json/streams/{stream_id}",
- {"new_description": "new description"},
+ {"description": "new description"},
)
self.assert_json_error(result, "Invalid stream id")