Skip to content

Commit

Permalink
adress changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBer78 committed Dec 20, 2024
1 parent c3172fd commit 5b0923c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/app/routers/test_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
import pytest

from neuroagent.app.config import Settings
from neuroagent.app.dependencies import get_agents_routine, get_settings
from neuroagent.app.dependencies import (
get_agents_routine,
get_settings,
get_starting_agent,
)
from neuroagent.app.main import app
from neuroagent.app.routers import qa
from neuroagent.new_types import Agent, Response


@pytest.mark.httpx_mock(can_send_already_matched_responses=True)
def test_run_agent(app_client, patch_required_env, httpx_mock, db_connection):
def test_run_agent(app_client, patch_required_env, httpx_mock):
agent_output = Response(
messages=[
{"role": "user", "content": "Hello"},
Expand All @@ -24,16 +28,13 @@ def test_run_agent(app_client, patch_required_env, httpx_mock, db_connection):
)
agent_routine = AsyncMock()
agent_routine.arun.return_value = agent_output
mock_agent = Agent()

test_settings = Settings(
db={"prefix": db_connection},
)
test_settings = Settings()
app.dependency_overrides[get_settings] = lambda: test_settings
app.dependency_overrides[get_agents_routine] = lambda: agent_routine
httpx_mock.add_response(
url=f"{test_settings.virtual_lab.get_project_url}/32c83739-f39c-49d1-833f-58c981ebd2a2/projects/123251a1-be18-4146-87b5-5ca2f8bfaf48"
# Not great to hardcode the Vlab and Project
)
app.dependency_overrides[get_starting_agent] = lambda: mock_agent

with app_client as app_client:
response = app_client.post("/qa/run", json={"query": "This is my query"})

Expand Down

0 comments on commit 5b0923c

Please sign in to comment.