Skip to content

Commit

Permalink
remove client changes
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-cohere committed Jun 19, 2024
1 parent cd713c6 commit 548bc7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/backend/routers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ async def update_agent(
)

try:
return agent_crud.update_agent(session, agent, new_agent)
agent = agent_crud.update_agent(session, agent, new_agent)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

return agent


@router.delete("/{agent_id}")
async def delete_agent(
Expand Down Expand Up @@ -166,6 +168,8 @@ async def delete_agent(
)

try:
return agent_crud.delete_agent(session, agent_id)
agent_crud.delete_agent(session, agent_id)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

return DeleteAgent()
8 changes: 4 additions & 4 deletions src/backend/tests/routers/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ def test_update_agent_wrong_user(session_client: TestClient, session: Session) -
f"/v1/agents/{agent.id}", json=request_json, headers={"User-Id": "456"}
)
assert response.status_code == 401
assert response.json() == {"detail": f"Agent with ID {agent.id} does not belong to user."}
assert response.json() == {
"detail": f"Agent with ID {agent.id} does not belong to user."
}


def test_update_agent_invalid_model(
Expand Down Expand Up @@ -498,8 +500,6 @@ def test_delete_agent(session_client: TestClient, session: Session) -> None:
def test_fail_delete_nonexistent_agent(
session_client: TestClient, session: Session
) -> None:
response = session_client.delete(
"/v1/agents/456", headers={"User-Id": "123"}
)
response = session_client.delete("/v1/agents/456", headers={"User-Id": "123"})
assert response.status_code == 400
assert response.json() == {"detail": "Agent with ID 456 not found."}

0 comments on commit 548bc7e

Please sign in to comment.