Merge pull request #2670 from GeorgianaElena/redirect_admin_to_login

/hub/admin redirect to login
This commit is contained in:
Tim Head
2019-08-05 22:03:38 +02:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -349,6 +349,7 @@ class SpawnPendingHandler(BaseHandler):
class AdminHandler(BaseHandler):
"""Render the admin page."""
@web.authenticated
@admin_only
def get(self):
available = {'name', 'admin', 'running', 'last_activity'}

View File

@@ -92,8 +92,9 @@ async def test_home_auth(app):
async def test_admin_no_auth(app):
r = await get_page('admin', app)
assert r.status_code == 403
r = await get_page('admin', app, allow_redirects=False)
assert r.status_code == 302
assert '/hub/login' in r.headers['Location']
async def test_admin_not_admin(app):