test_tornado: Fix leaking of event queue state.

Apparently, we weren't calling the proper clear functions inside the
Tornado tests, which resulted in unexpected behavior in other tests
that were relying on the Tornado event queue system being empty.

(In this case, a new test for mobile push notifications that assumed
receiver_is_off_zulip() was always true failed after this was run).
This commit is contained in:
Tim Abbott
2018-08-10 13:35:05 -07:00
parent 0c84260faa
commit 8ceb3b88ad

View File

@@ -50,6 +50,8 @@ class TornadoWebTestCase(AsyncHTTPTestCase, ZulipTestCase):
def tearDown(self) -> None:
super().tearDown()
self.session_cookie = None # type: Optional[Dict[str, str]]
# Important: we need to clear event queues to avoid leaking data to future tests.
event_queue.clear_client_event_queues_for_testing()
@override_settings(DEBUG=False)
def get_app(self) -> Application:
@@ -149,6 +151,8 @@ class WebSocketBaseTestCase(AsyncHTTPTestCase, ZulipTestCase):
def tearDown(self) -> None:
super().tearDown()
settings.RUNNING_INSIDE_TORNADO = False
# Important: we need to clear event queues to avoid leaking data to future tests.
event_queue.clear_client_event_queues_for_testing()
@gen.coroutine
def ws_connect(self, path: str, cookie_header: str,