Skip to content

Commit a50c8c6

Browse files
committed
Fix broken tests
1 parent 522ae45 commit a50c8c6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/a2a/auth/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
class User(ABC):
77
"""A representation of an authenticated user."""
88

9-
@abstractmethod
109
@property
10+
@abstractmethod
1111
def is_authenticated(self) -> bool:
1212
"""Returns whether the current user is authenticated."""
1313

14-
@abstractmethod
1514
@property
15+
@abstractmethod
1616
def user_name(self) -> str:
1717
"""Returns the user name of the current user."""
1818

src/a2a/server/apps/starlette_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from starlette.responses import JSONResponse, Response
1616
from starlette.routing import Route
1717

18+
from a2a.auth.user import UnauthenticatedUser
1819
from a2a.auth.user import User as A2AUser
1920
from a2a.server.context import ServerCallContext
2021
from a2a.server.request_handlers.jsonrpc_handler import JSONRPCHandler
@@ -60,7 +61,7 @@ class DefaultCallContextBuilder(CallContextBuilder):
6061
"""A default implementation of CallContextBuilder."""
6162

6263
def build(self, request: Request) -> ServerCallContext:
63-
user = None
64+
user = UnauthenticatedUser()
6465
state = {}
6566
with contextlib.suppress(Exception):
6667
user = request.user

src/a2a/server/context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import collections.abc
44
import typing
55

6-
from pydantic import BaseModel, Field
6+
from pydantic import BaseModel, ConfigDict, Field
77

88
from a2a.auth.user import UnauthenticatedUser, User
99

@@ -17,5 +17,7 @@ class ServerCallContext(BaseModel):
1717
This class allows storing arbitrary user data in the state attribute.
1818
"""
1919

20+
model_config = ConfigDict(arbitrary_types_allowed=True)
21+
2022
state: State = Field(default={})
2123
user: User = Field(default=UnauthenticatedUser())

0 commit comments

Comments
 (0)