test spawn-form for other users

This commit is contained in:
Min RK
2018-02-28 11:36:42 +01:00
parent b2527984bc
commit f3c22cb6d0

View File

@@ -189,8 +189,6 @@ def test_spawn_form(app):
})
r.raise_for_status()
assert r.history
print(u.spawner)
print(u.spawner.user_options)
assert u.spawner.user_options == {
'energy': '511keV',
'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
def test_spawn_form_with_file(app):
with mock.patch.dict(app.users.settings, {'spawner_class': FormSpawner}):