mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-14 21:43:01 +00:00
test default_url handling
- default_url is used even if not logged in - flesh out docstrings - pass via settings
This commit is contained in:
@@ -53,6 +53,30 @@ def test_root_redirect(app):
|
||||
assert path == ujoin(app.base_url, 'user/%s/test.ipynb' % name)
|
||||
|
||||
|
||||
@pytest.mark.gen_test
|
||||
def test_root_default_url_noauth(app):
|
||||
with mock.patch.dict(app.tornado_settings,
|
||||
{'default_url': '/foo/bar'}):
|
||||
r = yield get_page('/', app, allow_redirects=False)
|
||||
r.raise_for_status()
|
||||
url = r.headers.get('Location', '')
|
||||
path = urlparse(url).path
|
||||
assert path == '/foo/bar'
|
||||
|
||||
|
||||
@pytest.mark.gen_test
|
||||
def test_root_default_url_auth(app):
|
||||
name = 'wash'
|
||||
cookies = yield app.login_user(name)
|
||||
with mock.patch.dict(app.tornado_settings,
|
||||
{'default_url': '/foo/bar'}):
|
||||
r = yield get_page('/', app, cookies=cookies, allow_redirects=False)
|
||||
r.raise_for_status()
|
||||
url = r.headers.get('Location', '')
|
||||
path = urlparse(url).path
|
||||
assert path == '/foo/bar'
|
||||
|
||||
|
||||
@pytest.mark.gen_test
|
||||
def test_home_no_auth(app):
|
||||
r = yield get_page('home', app, allow_redirects=False)
|
||||
|
Reference in New Issue
Block a user