mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
Redirect user to login page when not logged in
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Tests for HTML pages"""
|
||||
|
||||
from urllib.parse import urlparse
|
||||
from urllib.parse import urlencode, urlparse
|
||||
|
||||
import requests
|
||||
|
||||
@@ -165,6 +165,14 @@ def test_user_redirect(app):
|
||||
path = urlparse(r.url).path
|
||||
assert path == '/user/%s/test.ipynb' % name
|
||||
|
||||
r = get_page('/user/baduser/test.ipynb', app)
|
||||
r.raise_for_status()
|
||||
print(urlparse(r.url))
|
||||
path = urlparse(r.url).path
|
||||
assert path == '/hub/login'
|
||||
query = urlparse(r.url).query
|
||||
assert query == urlencode({'next': '/hub/user/baduser/test.ipynb'})
|
||||
|
||||
|
||||
def test_static_files(app):
|
||||
base_url = ujoin(public_url(app), app.hub.server.base_url)
|
||||
|
Reference in New Issue
Block a user