mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Add SubscriptionRestApiTest.test_basic_add_delete.
(imported from commit 735d6a0657952790de1d58c62cc983320ec402e8)
This commit is contained in:
@@ -1429,6 +1429,37 @@ class SubscriptionPropertiesTest(AuthedTestCase):
|
|||||||
self.assert_json_error(result,
|
self.assert_json_error(result,
|
||||||
"Unknown subscription property: bad")
|
"Unknown subscription property: bad")
|
||||||
|
|
||||||
|
class SubscriptionRestApiTest(AuthedTestCase):
|
||||||
|
def test_basic_add_delete(self):
|
||||||
|
email = 'hamlet@zulip.com'
|
||||||
|
self.login(email)
|
||||||
|
|
||||||
|
# add
|
||||||
|
request = {
|
||||||
|
'add': ujson.dumps([{'name': 'my_test_stream_1'}])
|
||||||
|
}
|
||||||
|
result = self.client_patch(
|
||||||
|
"/api/v1/users/me/subscriptions",
|
||||||
|
request,
|
||||||
|
**self.api_auth(email)
|
||||||
|
)
|
||||||
|
self.assert_json_success(result)
|
||||||
|
streams = self.get_streams(email)
|
||||||
|
self.assertTrue('my_test_stream_1' in streams)
|
||||||
|
|
||||||
|
# now delete the same stream
|
||||||
|
request = {
|
||||||
|
'delete': ujson.dumps(['my_test_stream_1'])
|
||||||
|
}
|
||||||
|
result = self.client_patch(
|
||||||
|
"/api/v1/users/me/subscriptions",
|
||||||
|
request,
|
||||||
|
**self.api_auth(email)
|
||||||
|
)
|
||||||
|
self.assert_json_success(result)
|
||||||
|
streams = self.get_streams(email)
|
||||||
|
self.assertTrue('my_test_stream_1' not in streams)
|
||||||
|
|
||||||
class SubscriptionAPITest(AuthedTestCase):
|
class SubscriptionAPITest(AuthedTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user