-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(agents-api): Add route tests #451
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
from pycozo.client import Client | ||
|
||
from ..env import cozo_auth, cozo_host | ||
from ..web import app | ||
|
||
options = {"host": cozo_host} | ||
if cozo_auth: | ||
options.update({"auth": cozo_auth}) | ||
|
||
client = Client("http", options=options) | ||
|
||
def get_cozo_client(): | ||
client = getattr(app.state, "cozo_client", Client("http", options=options)) | ||
if not hasattr(app.state, "cozo_client"): | ||
app.state.cozo_client = client | ||
|
||
return client |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -27,4 +27,4 @@ async def create_or_update_agent( | |||||
data=data, | ||||||
) | ||||||
|
||||||
return ResourceCreatedResponse(id=agent.id, created_at=agent.created_at) | ||||||
return ResourceCreatedResponse(id=agent.id, created_at=agent.created_at, jobs=[]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,4 +20,4 @@ async def create_user( | |||||
data=data, | ||||||
) | ||||||
|
||||||
return ResourceCreatedResponse(id=user.id, created_at=user.created_at) | ||||||
return ResourceCreatedResponse(id=user.id, created_at=user.created_at, jobs=[]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
async def delete_user( | ||
user_id: UUID4, x_developer_id: Annotated[UUID4, Depends(get_developer_id)] | ||
) -> ResourceDeletedResponse: | ||
print(user_id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
return delete_user_query(developer_id=x_developer_id, user_id=user_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a randomly generated API key as a fallback is potentially insecure and could lead to unpredictable behavior. Consider requiring the API key to be set explicitly and fail initialization if it's not provided.