File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,8 @@ def check_request(
121
121
assert request .headers ["x-workflowai-source" ] == "sdk"
122
122
assert request .headers ["x-workflowai-language" ] == "python"
123
123
124
+ return body
125
+
124
126
125
127
@pytest .fixture
126
128
def test_client (httpx_mock : HTTPXMock ) -> IntTestClient :
Original file line number Diff line number Diff line change @@ -38,6 +38,22 @@ async def city_to_capital(task_input: CityToCapitalTaskInput) -> Run[CityToCapit
38
38
test_client .check_request ()
39
39
40
40
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
+
41
57
async def test_run_task_run_version (test_client : IntTestClient ) -> None :
42
58
@workflowai .agent (schema_id = 1 , version = "staging" )
43
59
async def city_to_capital (task_input : CityToCapitalTaskInput ) -> Run [CityToCapitalTaskOutput ]: ...
You can’t perform that action at this time.
0 commit comments