Track art-common master branch, add auth tests

Fix UserContext l2_server field not found error by tracking
master branch instead of pinned commit.

- Update art-common to track master branch
- Add tests for UserContext l2_server field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 10:25:54 +00:00
parent 1e542a1e0b
commit 19e2277155
2 changed files with 44 additions and 2 deletions

View File

@@ -13,5 +13,5 @@ numpy>=1.24.0
opencv-python-headless>=4.8.0 opencv-python-headless>=4.8.0
# Core artdag from GitHub (tracks main branch) # Core artdag from GitHub (tracks main branch)
git+https://github.com/gilesbradshaw/art-dag.git@main git+https://github.com/gilesbradshaw/art-dag.git@main
# Shared components # Shared components (tracks master branch)
git+https://git.rose-ash.com/art-dag/common.git@889ea98 git+https://git.rose-ash.com/art-dag/common.git@master

42
tests/test_auth.py Normal file
View File

@@ -0,0 +1,42 @@
"""
Tests for authentication service.
"""
import pytest
class TestUserContext:
"""Tests for UserContext dataclass."""
def test_user_context_accepts_l2_server(self) -> None:
"""
Regression test: UserContext must accept l2_server field.
Bug found 2026-01-12: auth_service.py passes l2_server to UserContext
but the art-common library was pinned to old version without this field.
"""
from artdag_common.middleware.auth import UserContext
# This should not raise TypeError
ctx = UserContext(
username="testuser",
actor_id="@testuser@example.com",
token="test-token",
l2_server="https://l2.example.com",
)
assert ctx.username == "testuser"
assert ctx.actor_id == "@testuser@example.com"
assert ctx.token == "test-token"
assert ctx.l2_server == "https://l2.example.com"
def test_user_context_l2_server_optional(self) -> None:
"""l2_server should be optional (default None)."""
from artdag_common.middleware.auth import UserContext
ctx = UserContext(
username="testuser",
actor_id="@testuser@example.com",
)
assert ctx.l2_server is None