feat(dashboard): persist administrator login
This commit is contained in:
@@ -6,7 +6,7 @@ from streamlit.testing.v1 import AppTest
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from dashboard.app import get_transfer_review_items
|
||||
from dashboard.authentication import ADMIN_ID_ENV, ADMIN_PASSWORD_ENV
|
||||
from dashboard import authentication
|
||||
from scripts.ci_fixture_db import create_ci_fixture_db
|
||||
|
||||
|
||||
@@ -44,8 +44,13 @@ def test_streamlit_apptest_core_pages_use_synthetic_fixture_db(tmp_path, monkeyp
|
||||
fixture = tmp_path / "fixture.sqlite3"
|
||||
create_ci_fixture_db(fixture)
|
||||
monkeypatch.setenv("JARCA_LEDGER_DB_PATH", str(fixture))
|
||||
monkeypatch.setenv(ADMIN_ID_ENV, "test-admin")
|
||||
monkeypatch.setenv(ADMIN_PASSWORD_ENV, "test-password")
|
||||
monkeypatch.setenv(authentication.ADMIN_ID_ENV, "test-admin")
|
||||
monkeypatch.setenv(authentication.ADMIN_PASSWORD_ENV, "test-password")
|
||||
monkeypatch.setenv(authentication.SIGNING_SECRET_ENV, "s" * 64)
|
||||
settings = authentication.load_auth_settings()
|
||||
assert settings is not None
|
||||
token = authentication.issue_persistent_token(settings, remember_me=False).value
|
||||
monkeypatch.setattr(authentication, "_request_cookie", lambda: token)
|
||||
|
||||
app_path = Path(__file__).resolve().parents[1] / "dashboard" / "app.py"
|
||||
page_expectations = {
|
||||
@@ -61,10 +66,6 @@ def test_streamlit_apptest_core_pages_use_synthetic_fixture_db(tmp_path, monkeyp
|
||||
if page == "월정산":
|
||||
at.query_params["month"] = "2026-06"
|
||||
at.run()
|
||||
at.text_input[0].input("test-admin")
|
||||
at.text_input[1].input("test-password")
|
||||
next(button for button in at.button if button.label == "로그인").click()
|
||||
at.run()
|
||||
assert not at.exception
|
||||
body_text = "\n".join(str(item.value) for item in list(at.text) + list(at.markdown) + list(at.caption))
|
||||
assert expected_text in body_text
|
||||
|
||||
Reference in New Issue
Block a user