Replace /json/get_public_streams with REST style route.

This commit is contained in:
Ashish Kumar 2016-04-17 18:17:43 +05:30 committed by Tim Abbott
parent 362a622f1f
commit b5ab4d45f9
3 changed files with 9 additions and 6 deletions

View File

@ -494,8 +494,9 @@ exports.setup_page = function () {
}
if (should_list_all_streams()) {
var req = channel.post({
url: '/json/get_public_streams',
var req = channel.get({
url: '/json/streams',
data: {"include_subscribed": false},
idempotent: true,
timeout: 10*1000,
success: populate_and_fill,

View File

@ -56,6 +56,7 @@ class PublicURLTest(TestCase):
"/api/v1/users/me/subscriptions",
"/api/v1/messages",
"/json/messages",
"/json/streams",
],
}
post_urls = {200: ["/accounts/login/"],

View File

@ -254,7 +254,7 @@ class StreamAdminTest(AuthedTestCase):
self.assertEqual(subscribers, [])
# It doesn't show up in the list of public streams anymore.
result = self.client.post("/json/get_public_streams")
result = self.client.get("/json/streams?include_subscribed=false")
public_streams = [s["name"] for s in ujson.loads(result.content)["streams"]]
self.assertNotIn(active_name, public_streams)
self.assertNotIn(deactivated_stream_name, public_streams)
@ -1230,12 +1230,12 @@ class GetPublicStreamsTest(AuthedTestCase):
def test_public_streams(self):
"""
Ensure that get_public_streams successfully returns a list of streams
Ensure that streams successfully returns a list of streams
"""
email = 'hamlet@zulip.com'
self.login(email)
result = self.client.post("/json/get_public_streams")
result = self.client.get("/json/streams?include_subscribed=false")
self.assert_json_success(result)
json = ujson.loads(result.content)
@ -1245,7 +1245,8 @@ class GetPublicStreamsTest(AuthedTestCase):
def test_public_streams_api(self):
"""
Ensure that get_public_streams successfully returns a list of streams
Ensure that the query we use to get public streams successfully returns
a list of streams
"""
email = 'hamlet@zulip.com'
self.login(email)