Files
the-littlest-jupyterhub/integration-tests/test_admin_installer.py

29 lines
878 B
Python
Raw Normal View History

2019-07-16 20:18:45 +03:00
from functools import partial
import pytest
from hubtraf.auth.dummy import login_dummy
from hubtraf.user import User
hub_url = "http://localhost"
2019-07-16 20:18:45 +03:00
@pytest.mark.parametrize(
"username, password, expect_successful_login",
2019-07-16 20:18:45 +03:00
[
("test-admin-username", "wrong_passw", False),
("test-admin-username", "test-admin-password", True),
("test-admin-username", "", False),
("user", "", False),
("user", "password", False),
2019-07-16 20:18:45 +03:00
],
)
async def test_pre_configured_admin_login(username, password, expect_successful_login):
2019-07-16 20:18:45 +03:00
"""
Verify that the "--admin <username>:<password>" flag allows that user/pass
combination and no other user can login.
2019-07-16 20:18:45 +03:00
"""
async with User(username, hub_url, partial(login_dummy, password=password)) as u:
user_logged_in = await u.login()
assert user_logged_in == expect_successful_login