Merge pull request #599 from GeorgianaElena/update-hubtraf-calls

This commit is contained in:
Yuvi Panda
2020-07-21 16:18:20 +00:00
committed by GitHub
2 changed files with 15 additions and 19 deletions

View File

@@ -17,8 +17,8 @@ async def test_admin_login():
async with User(username, hub_url, partial(login_dummy, password=password)) as u:
await u.login()
await u.ensure_server()
# If user is not logged in, this will raise an exception
await u.ensure_server_simulate()
@pytest.mark.asyncio
@pytest.mark.parametrize(
@@ -35,11 +35,7 @@ async def test_unsuccessful_login(username, password):
"""
hub_url = 'http://localhost'
try:
async with User(username, hub_url, partial(login_dummy, password="")) as u:
await u.login()
except Exception:
# This is what we except to happen
pass
else:
raise
user_logged_in = await u.login()
assert user_logged_in == False

View File

@@ -38,7 +38,7 @@ async def test_user_code_execute():
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
await u.ensure_server()
await u.ensure_server_simulate()
await u.start_kernel()
await u.assert_code_output("5 * 4", "20", 5, 5)
@@ -62,7 +62,7 @@ async def test_user_admin_add():
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
assert pwd.getpwnam(f'jupyter-{username}') is not None
@@ -91,7 +91,7 @@ async def test_user_admin_remove():
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
assert pwd.getpwnam(f'jupyter-{username}') is not None
@@ -103,7 +103,7 @@ async def test_user_admin_remove():
assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'reload')).wait()
await u.stop_server()
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user does *not* have admin rights
assert f'jupyter-{username}' not in grp.getgrnam('jupyterhub-admins').gr_mem
@@ -125,7 +125,7 @@ async def test_long_username():
try:
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
system_username = generate_system_username(f'jupyter-{username}')
@@ -162,7 +162,7 @@ async def test_user_group_adding():
try:
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
system_username = generate_system_username(f'jupyter-{username}')
@@ -207,7 +207,7 @@ async def test_idle_server_culled():
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
# Start user's server
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
assert pwd.getpwnam(f'jupyter-{username}') is not None
@@ -252,7 +252,7 @@ async def test_active_server_not_culled():
async with User(username, hub_url, partial(login_dummy, password='')) as u:
await u.login()
# Start user's server
await u.ensure_server()
await u.ensure_server_simulate()
# Assert that the user exists
assert pwd.getpwnam(f'jupyter-{username}') is not None