zcommand: Add /fluid-width and /fixed-width slash commands.

This commit is contained in:
Wyatt Hoodes
2020-03-11 20:51:47 -10:00
committed by Tim Abbott
parent 5cf8ddf630
commit 13f86f35d9
4 changed files with 106 additions and 0 deletions

View File

@@ -53,3 +53,33 @@ class ZcommandTest(ZulipTestCase):
result = self.client_post("/json/zcommand", payload)
self.assert_json_success(result)
self.assertIn('still in day mode', result.json()['msg'])
def test_fluid_zcommand(self) -> None:
self.login("hamlet")
user = self.example_user("hamlet")
user.fluid_layout_width = False
user.save()
payload = dict(command="/fluid-width")
result = self.client_post("/json/zcommand", payload)
self.assert_json_success(result)
self.assert_in_response('Changed to fluid-width mode!', result)
result = self.client_post("/json/zcommand", payload)
self.assert_json_success(result)
self.assert_in_response('You are still in fluid width mode', result)
def test_fixed_zcommand(self) -> None:
self.login("hamlet")
user = self.example_user("hamlet")
user.fluid_layout_width = True
user.save()
payload = dict(command="/fixed-width")
result = self.client_post("/json/zcommand", payload)
self.assert_json_success(result)
self.assert_in_response('Changed to fixed-width mode!', result)
result = self.client_post("/json/zcommand", payload)
self.assert_json_success(result)
self.assert_in_response('You are still in fixed width mode', result)