From 0a952b1a6637821023bb3e124fa8712ad382786d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 11 Dec 2013 14:27:40 -0500 Subject: [PATCH] Fix abuse of bugging login behavior with API URLs. (imported from commit 3009cd094dff8891da415e1bfcf596ea6cb38abc) --- zerver/tests.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zerver/tests.py b/zerver/tests.py index ddf2817803..cf96836953 100644 --- a/zerver/tests.py +++ b/zerver/tests.py @@ -2833,9 +2833,11 @@ class GetSubscribersTest(AuthedTestCase): stream_name, domain)] self.assertItemsEqual(result["subscribers"], true_subscribers) - def make_subscriber_request(self, stream_name): + def make_subscriber_request(self, stream_name, email=None): + if email is None: + email = self.email return self.client.get("/api/v1/streams/%s/members" % (stream_name,), - **self.api_auth(self.email)) + **self.api_auth(email)) def make_successful_subscriber_request(self, stream_name): result = self.make_subscriber_request(stream_name) @@ -2939,14 +2941,13 @@ class GetSubscribersTest(AuthedTestCase): A non-subscriber to a private stream can't query that stream's membership. """ # Create a private stream for which Hamlet is the only subscriber. - stream_name = "Saxony" + stream_name = "NewStream" self.common_subscribe_to_streams(self.email, [stream_name], invite_only=True) other_email = "othello@zulip.com" # Try to fetch the subscriber list as a non-member. - self.login(other_email) - result = self.make_subscriber_request(stream_name) + result = self.make_subscriber_request(stream_name, email=other_email) self.assert_json_error(result, "Unable to retrieve subscribers for invite-only stream")