mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
zcommand: Strip the slash in the backend.
The slash in command is stripped in the backend, rather than in the client to make the client code cleaner. This would make client code cleaner in the slash commands which include parameters.
This commit is contained in:
@@ -9,14 +9,14 @@ class ZcommandTest(ZulipTestCase):
|
||||
def test_invalid_zcommand(self) -> None:
|
||||
self.login(self.example_email("hamlet"))
|
||||
|
||||
payload = dict(command="boil-ocean")
|
||||
payload = dict(command="/boil-ocean")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_error(result, "No such command: boil-ocean")
|
||||
|
||||
def test_ping_zcommand(self) -> None:
|
||||
self.login(self.example_email("hamlet"))
|
||||
|
||||
payload = dict(command="ping")
|
||||
payload = dict(command="/ping")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
|
||||
@@ -26,7 +26,7 @@ class ZcommandTest(ZulipTestCase):
|
||||
user.night_mode = False
|
||||
user.save()
|
||||
|
||||
payload = dict(command="night")
|
||||
payload = dict(command="/night")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn('Changed to night', result.json()['msg'])
|
||||
@@ -41,7 +41,7 @@ class ZcommandTest(ZulipTestCase):
|
||||
user.night_mode = True
|
||||
user.save()
|
||||
|
||||
payload = dict(command="day")
|
||||
payload = dict(command="/day")
|
||||
result = self.client_post("/json/zcommand", payload)
|
||||
self.assert_json_success(result)
|
||||
self.assertIn('Changed to day', result.json()['msg'])
|
||||
|
||||
Reference in New Issue
Block a user