mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 15:33:02 +00:00
test spawn-form for other users
This commit is contained in:
@@ -189,8 +189,6 @@ def test_spawn_form(app):
|
|||||||
})
|
})
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
assert r.history
|
assert r.history
|
||||||
print(u.spawner)
|
|
||||||
print(u.spawner.user_options)
|
|
||||||
assert u.spawner.user_options == {
|
assert u.spawner.user_options == {
|
||||||
'energy': '511keV',
|
'energy': '511keV',
|
||||||
'bounds': [-1, 1],
|
'bounds': [-1, 1],
|
||||||
@@ -198,6 +196,29 @@ def test_spawn_form(app):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.gen_test
|
||||||
|
def test_spawn_form_admin_access(app, admin_access):
|
||||||
|
with mock.patch.dict(app.users.settings, {'spawner_class': FormSpawner}):
|
||||||
|
base_url = ujoin(public_host(app), app.hub.base_url)
|
||||||
|
cookies = yield app.login_user('admin')
|
||||||
|
u = add_user(app.db, app=app, name='martha')
|
||||||
|
|
||||||
|
r = yield async_requests.post(
|
||||||
|
ujoin(base_url, 'spawn/{0}?next=/user/{0}/tree'.format(u.name)),
|
||||||
|
cookies=cookies, data={
|
||||||
|
'bounds': ['-3', '3'],
|
||||||
|
'energy': '938MeV',
|
||||||
|
})
|
||||||
|
r.raise_for_status()
|
||||||
|
assert r.history
|
||||||
|
assert r.url.startswith(public_url(app, u))
|
||||||
|
assert u.spawner.user_options == {
|
||||||
|
'energy': '938MeV',
|
||||||
|
'bounds': [-3, 3],
|
||||||
|
'notspecified': 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.gen_test
|
@pytest.mark.gen_test
|
||||||
def test_spawn_form_with_file(app):
|
def test_spawn_form_with_file(app):
|
||||||
with mock.patch.dict(app.users.settings, {'spawner_class': FormSpawner}):
|
with mock.patch.dict(app.users.settings, {'spawner_class': FormSpawner}):
|
||||||
|
Reference in New Issue
Block a user