2022-09-13 08:39:44 +02:00
|
|
|
import orjson
|
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
from zerver.lib.test_classes import ZulipTestCase
|
|
|
|
|
2018-11-09 19:45:25 +01:00
|
|
|
|
|
|
|
class LegacySubjectTest(ZulipTestCase):
|
|
|
|
def test_legacy_subject(self) -> None:
|
2021-02-12 08:20:45 +01:00
|
|
|
self.login("hamlet")
|
2018-11-09 19:45:25 +01:00
|
|
|
|
|
|
|
payload = dict(
|
2021-02-12 08:20:45 +01:00
|
|
|
type="stream",
|
2022-09-13 08:39:44 +02:00
|
|
|
to=orjson.dumps("Verona").decode(),
|
2021-02-12 08:20:45 +01:00
|
|
|
content="Test message",
|
2018-11-09 19:45:25 +01:00
|
|
|
)
|
|
|
|
|
2021-02-12 08:20:45 +01:00
|
|
|
payload["subject"] = "whatever"
|
2018-11-09 19:45:25 +01:00
|
|
|
result = self.client_post("/json/messages", payload)
|
|
|
|
self.assert_json_success(result)
|
|
|
|
|
|
|
|
# You can't use both subject and topic.
|
2021-02-12 08:20:45 +01:00
|
|
|
payload["topic"] = "whatever"
|
2018-11-09 19:45:25 +01:00
|
|
|
result = self.client_post("/json/messages", payload)
|
|
|
|
self.assert_json_error(result, "Can't decide between 'topic' and 'subject' arguments")
|