Skip to content

Commit e97cd03

Browse files
committed
test: add test_run_task_run_with_fallback
1 parent 02bd32c commit e97cd03

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/integration/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def check_request(
121121
assert request.headers["x-workflowai-source"] == "sdk"
122122
assert request.headers["x-workflowai-language"] == "python"
123123

124+
return body
125+
124126

125127
@pytest.fixture
126128
def test_client(httpx_mock: HTTPXMock) -> IntTestClient:

tests/integration/run_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ async def city_to_capital(task_input: CityToCapitalTaskInput) -> Run[CityToCapit
3838
test_client.check_request()
3939

4040

41+
async def test_run_task_run_with_fallback(test_client: IntTestClient) -> None:
42+
@workflowai.agent(schema_id=1)
43+
async def city_to_capital(task_input: CityToCapitalTaskInput) -> Run[CityToCapitalTaskOutput]: ...
44+
45+
test_client.mock_response()
46+
47+
task_input = CityToCapitalTaskInput(city="Hello")
48+
with_run = await city_to_capital(task_input, use_fallback="never")
49+
50+
assert with_run.id == "123"
51+
assert with_run.output.capital == "Tokyo"
52+
53+
body = test_client.check_request()
54+
assert body["use_fallback"] == "never"
55+
56+
4157
async def test_run_task_run_version(test_client: IntTestClient) -> None:
4258
@workflowai.agent(schema_id=1, version="staging")
4359
async def city_to_capital(task_input: CityToCapitalTaskInput) -> Run[CityToCapitalTaskOutput]: ...

0 commit comments

Comments
 (0)