From d9fc40652d35bd930a2f4d158ffe2fd73c847c2e Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 6 Apr 2015 17:04:41 -0700 Subject: [PATCH] test shutdown API handler --- jupyterhub/tests/test_api.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/jupyterhub/tests/test_api.py b/jupyterhub/tests/test_api.py index 45848144..1eb21830 100644 --- a/jupyterhub/tests/test_api.py +++ b/jupyterhub/tests/test_api.py @@ -1,6 +1,7 @@ """Tests for the REST API""" import json +import time from datetime import timedelta import requests @@ -284,3 +285,18 @@ def test_get_proxy(app, io_loop): r.raise_for_status() reply = r.json() assert list(reply.keys()) == ['/'] + + +def test_shutdown(app): + r = api_request(app, 'shutdown', method='post', data=json.dumps({ + 'servers': True, + 'proxy': True, + })) + r.raise_for_status() + reply = r.json() + for i in range(100): + if app.io_loop._running: + time.sleep(0.1) + else: + break + assert not app.io_loop._running