mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-30 17:52:26 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af4e25dd1 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Both stages need the fixed native decoder, including curl in the builder and
|
# Both stages need the fixed native decoder, including curl in the builder and
|
||||||
# distro Node in the runtime. A cached Python base may predate the Debian fix.
|
# distro Node in the runtime. A cached Python base may predate the Debian fix.
|
||||||
FROM python:3.14.9-slim AS brotli-base
|
FROM python:3.15.0-slim AS brotli-base
|
||||||
COPY scripts/check_brotli.py /usr/local/bin/check-brotli.py
|
COPY scripts/check_brotli.py /usr/local/bin/check-brotli.py
|
||||||
COPY scripts/check_ca_trust.py /usr/local/bin/check-ca-trust.py
|
COPY scripts/check_ca_trust.py /usr/local/bin/check-ca-trust.py
|
||||||
# Check inherited trust before the first HTTPS package request, retaining Debian's
|
# Check inherited trust before the first HTTPS package request, retaining Debian's
|
||||||
|
|||||||
@@ -14,22 +14,12 @@ from routes.auth_routes import SESSION_COOKIE
|
|||||||
from tests.helpers.database import disposable_database
|
from tests.helpers.database import disposable_database
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture
|
||||||
def auth_configuration(tmp_path_factory):
|
def authenticated_app(tmp_path, monkeypatch):
|
||||||
"""Hash real fixture passwords once; only immutable bytes are reused."""
|
monkeypatch.setenv("AUTH_ENABLED", "true")
|
||||||
path = tmp_path_factory.mktemp("admin-auth-seed") / "auth.json"
|
auth = AuthManager(str(tmp_path / "auth.json"))
|
||||||
auth = AuthManager(str(path))
|
|
||||||
for user, admin in (("member", False), ("admin", True)):
|
for user, admin in (("member", False), ("admin", True)):
|
||||||
assert auth.create_user(user, "disposable-test-password", is_admin=admin)
|
assert auth.create_user(user, "disposable-test-password", is_admin=admin)
|
||||||
return path.read_bytes()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def authenticated_app(tmp_path, monkeypatch, auth_configuration):
|
|
||||||
monkeypatch.setenv("AUTH_ENABLED", "true")
|
|
||||||
path = tmp_path / "auth.json"
|
|
||||||
path.write_bytes(auth_configuration)
|
|
||||||
auth = AuthManager(str(path))
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
app.state.auth_manager = auth
|
app.state.auth_manager = auth
|
||||||
|
|
||||||
@@ -143,17 +133,3 @@ def test_diagnostics_require_real_admin_before_sensitive_work(
|
|||||||
for operation in (stats, rag.get_stats, research.call_research_service,
|
for operation in (stats, rag.get_stats, research.call_research_service,
|
||||||
extract_id, transcript, collect, read_log):
|
extract_id, transcript, collect, read_log):
|
||||||
operation.assert_not_called()
|
operation.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("instance", [0, 1])
|
|
||||||
def test_authenticated_fixture_has_private_users_sessions_and_file(authenticated_app, instance):
|
|
||||||
app, client_for = authenticated_app
|
|
||||||
auth = app.state.auth_manager
|
|
||||||
assert set(auth.users) == {"member", "admin"}
|
|
||||||
assert not auth._sessions
|
|
||||||
with client_for("member") as client:
|
|
||||||
assert auth.get_username_for_token(client.cookies.get(SESSION_COOKIE)) == "member"
|
|
||||||
assert auth.create_user("fixture-local", "disposable-test-password")
|
|
||||||
# Both parameter cases mutate their own file. Any shared manager, mutable
|
|
||||||
# users/sessions or written-back seed makes the next case fail, in any order.
|
|
||||||
assert "fixture-local" in auth.users
|
|
||||||
|
|||||||
Reference in New Issue
Block a user