Redirect user to login page when not logged in

This commit is contained in:
Dara Adib
2016-03-02 16:55:33 -08:00
parent fdd3746f54
commit 5a10d304c9
2 changed files with 18 additions and 2 deletions

View File

@@ -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)