mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
webhook tests: Avoid lots of unnecessary json dumping.
Commit c4254497b2
curiously had get_body() round tripping its data
through json load and dump.
I have seen this done for pretty-printing reasons,
but it doesn't apply here.
And if you're doing it for validation reasons,
you only need to do half the work, as my commit
here demonstrates.
We arguably don't even need the fail-fast code
here, since our fixtures are linted to be proper
json, I believe, plus downstream code probably
gives reasonably easy-to-diagnose symptoms.
This commit is contained in:
@@ -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
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user