mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
tests: Refactor away result.json() calls with helpers.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
a6e2453323
commit
a142fbff85
@@ -29,12 +29,12 @@ class ZcommandTest(ZulipTestCase):
|
||||
|
||||
payload = dict(command="/night")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn("Changed to dark theme", result.json()["msg"])
|
||||
response_dict = self.assert_json_success(result)
|
||||
self.assertIn("Changed to dark theme", response_dict["msg"])
|
||||
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn("still in dark theme", result.json()["msg"])
|
||||
response_dict = self.assert_json_success(result)
|
||||
self.assertIn("still in dark theme", response_dict["msg"])
|
||||
|
||||
def test_day_zcommand(self) -> None:
|
||||
self.login("hamlet")
|
||||
@@ -44,12 +44,12 @@ class ZcommandTest(ZulipTestCase):
|
||||
|
||||
payload = dict(command="/day")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn("Changed to light theme", result.json()["msg"])
|
||||
response_dict = self.assert_json_success(result)
|
||||
self.assertIn("Changed to light theme", response_dict["msg"])
|
||||
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn("still in light theme", result.json()["msg"])
|
||||
response_dict = self.assert_json_success(result)
|
||||
self.assertIn("still in light theme", response_dict["msg"])
|
||||
|
||||
def test_fluid_zcommand(self) -> None:
|
||||
self.login("hamlet")
|
||||
|
||||
Reference in New Issue
Block a user