From e2a6adc143adfeb7063a6e693698d8a180c03394 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 31 Jan 2014 12:08:23 -0500 Subject: [PATCH] Verify Cordelia is no longer subscribed inside attempt_unsubscribe_of_principal(). Before this change, we were doing assertNotIn to verify that Cordelia was not among our subscribers after calling /json/subscriptions/remove, but we were then catching the AssertionError except for every case. We really only want to bypass the assertion when the server had reported an error. (imported from commit 0bdaf23047b795721372251724228daf18677df5) --- zerver/test_subs.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/zerver/test_subs.py b/zerver/test_subs.py index 82e0bf57a3..d67c0b4066 100644 --- a/zerver/test_subs.py +++ b/zerver/test_subs.py @@ -326,13 +326,10 @@ class StreamAdminTest(AuthedTestCase): {"subscriptions": ujson.dumps([stream.name]), "principals": ujson.dumps([other_email])}) - try: - # If the removal was successful, check that the principal is no - # longer subbed. - self.assertNotIn(other_user_profile, self.users_subscribed_to_stream( - stream_name, other_user_profile.realm.domain)) - except AssertionError: - pass + # If the removal succeeded, then assert that Cordelia is no longer subscribed. + if result.status_code not in [400]: + subbed_users = self.users_subscribed_to_stream(stream_name, other_user_profile.realm.domain) + self.assertNotIn(other_user_profile, subbed_users) return result