Files
zulip/zerver/tests/test_legacy_subject.py
Lauryn Menard 47056ef06f tests: Remove client parameter if test can use default User-Agent.
Removes `client` parameter from backend tests using the
`POST /messages` endpoint when the test can use the default
`User-Agent` as the client, which is set to `ZulipMobile` for API
requests and a browser user agent string for web app requests.
2022-02-24 12:57:18 -08:00

22 lines
673 B
Python

from zerver.lib.test_classes import ZulipTestCase
class LegacySubjectTest(ZulipTestCase):
def test_legacy_subject(self) -> None:
self.login("hamlet")
payload = dict(
type="stream",
to="Verona",
content="Test message",
)
payload["subject"] = "whatever"
result = self.client_post("/json/messages", payload)
self.assert_json_success(result)
# You can't use both subject and topic.
payload["topic"] = "whatever"
result = self.client_post("/json/messages", payload)
self.assert_json_error(result, "Can't decide between 'topic' and 'subject' arguments")