-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/support_indexed_search' into MAJOR_CHANGE/new_front
- Loading branch information
Showing
5 changed files
with
51 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import httpx | ||
import pytest | ||
from httpx_ws import aconnect_ws | ||
from httpx_ws.transport import ASGIWebSocketTransport | ||
|
||
from app.api.deps import get_build_manager, get_run_manager | ||
from app.core.logger_config import get_logger | ||
from app.main import app | ||
from app.tests.conftest import override_dependency, start_process | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
async def _assert_process_status(response, process_manager): | ||
assert response.json().get("status") == "ok", "Start process response status is not 'ok'" | ||
process_manager.check_status.assert_awaited_once() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_all(mocker): | ||
async with httpx.AsyncClient(transport=ASGIWebSocketTransport(app)) as client: | ||
async with override_dependency(mocker, get_build_manager) as process_manager: | ||
response = await start_process( | ||
client, | ||
endpoint="http://localhost:8000/api/v1/bot/build/start", | ||
preset_end_status="success", | ||
) | ||
build_id = process_manager.get_last_id() | ||
await _assert_process_status(response, process_manager) | ||
|
||
async with override_dependency(mocker, get_run_manager) as process_manager: | ||
response = await start_process( | ||
client, | ||
endpoint=f"http://localhost:8000/api/v1/bot/run/start/{build_id}", | ||
preset_end_status="success", | ||
) | ||
await _assert_process_status(response, process_manager) | ||
|
||
run_id = process_manager.get_last_id() | ||
async with aconnect_ws(f"http://localhost:8000/api/v1/bot/run/connect?run_id={run_id}", client) as ws: | ||
message = await ws.receive_text() | ||
assert message == "Start chatting" | ||
|
||
# TODO: Check if it could send message, then recieve reply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters