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.

webhook tests: Avoid lots of unnecessary json dumping.

Steve Howell95fe690e8d64
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index 6969d8ae7f0..4c524886a09 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -1152,7 +1152,10 @@ class WebhookTestCase(ZulipTestCase):
def get_body(self, fixture_name: str) -> str:
assert self.FIXTURE_DIR_NAME is not None
- return orjson.dumps(orjson.loads(self.webhook_fixture_data(self.FIXTURE_DIR_NAME, fixture_name))).decode()
+ body = self.webhook_fixture_data(self.FIXTURE_DIR_NAME, fixture_name)
+ # fail fast if we don't have valid json
+ orjson.loads(body)
+ return body
class MigrationsTestCase(ZulipTestCase): # nocoverage
"""