@@ -362,13 +362,13 @@ async def test_start_new_delegates_to_schedule_new_orchestration():
362362 await client .close ()
363363
364364
365- async def test_get_status_delegates_to_get_orchestration_state ():
365+ async def test_get_status_always_fetches_payloads ():
366366 client = _make_client ()
367367 try :
368368 with patch .object (client , "get_orchestration_state" ,
369369 new = AsyncMock (return_value = None )) as mock :
370370 with pytest .warns (DeprecationWarning ):
371- await client .get_status ("abc" , show_input = True )
371+ await client .get_status ("abc" )
372372 mock .assert_awaited_once_with ("abc" , fetch_payloads = True )
373373 finally :
374374 await client .close ()
@@ -381,7 +381,9 @@ async def test_get_status_all_delegates():
381381 new = AsyncMock (return_value = [])) as mock :
382382 with pytest .warns (DeprecationWarning ):
383383 await client .get_status_all ()
384- mock .assert_awaited_once_with ()
384+ mock .assert_awaited_once ()
385+ query = mock .await_args .args [0 ]
386+ assert query .fetch_inputs_and_outputs is True
385387 finally :
386388 await client .close ()
387389
@@ -498,8 +500,10 @@ async def test_get_status_by_maps_statuses():
498500 with pytest .warns (DeprecationWarning ):
499501 await client .get_status_by (
500502 runtime_status = [df .OrchestrationRuntimeStatus .Running ])
503+ mock .assert_awaited_once ()
501504 query = mock .await_args .args [0 ]
502505 assert query .runtime_status == [OrchestrationStatus .RUNNING ]
506+ assert query .fetch_inputs_and_outputs is True
503507 finally :
504508 await client .close ()
505509
@@ -688,16 +692,20 @@ def test_entity_class_raises_not_implemented():
688692# Return-type shims: DurableOrchestrationStatus
689693# ---------------------------------------------------------------------------
690694
691- def _fake_state ():
695+ def _fake_state (
696+ runtime_status = OrchestrationStatus .RUNNING ,
697+ serialized_output = '{"out": 2}' ,
698+ failure_details = None ):
692699 return SimpleNamespace (
693700 name = "orch" ,
694701 instance_id = "abc" ,
695702 created_at = datetime (2026 , 1 , 1 , tzinfo = timezone .utc ),
696703 last_updated_at = datetime (2026 , 1 , 2 , tzinfo = timezone .utc ),
697- runtime_status = OrchestrationStatus . RUNNING ,
704+ runtime_status = runtime_status ,
698705 serialized_input = '{"in": 1}' ,
699- serialized_output = '{"out": 2}' ,
706+ serialized_output = serialized_output ,
700707 serialized_custom_status = '"cs"' ,
708+ failure_details = failure_details ,
701709 get_input = lambda : {"in" : 1 },
702710 get_output = lambda : {"out" : 2 },
703711 get_custom_status = lambda : "cs" ,
@@ -710,21 +718,61 @@ def test_from_durabletask_status_reverse_mapping():
710718 OrchestrationStatus .CONTINUED_AS_NEW ) == df .OrchestrationRuntimeStatus .ContinuedAsNew
711719
712720
713- async def test_get_status_returns_wrapped_status ():
721+ async def test_get_status_suppresses_only_input_by_default ():
714722 client = _make_client ()
715723 try :
724+ state = _fake_state (runtime_status = OrchestrationStatus .COMPLETED )
716725 with patch .object (client , "get_orchestration_state" ,
717- new = AsyncMock (return_value = _fake_state () )):
726+ new = AsyncMock (return_value = state )):
718727 with pytest .warns (DeprecationWarning ):
719728 status = await client .get_status ("abc" )
720729 assert bool (status ) is True
721730 assert status .name == "orch"
722731 assert status .instance_id == "abc"
723- assert status .runtime_status == df .OrchestrationRuntimeStatus .Running
724- assert status .input_ == { "in" : 1 }
732+ assert status .runtime_status == df .OrchestrationRuntimeStatus .Completed
733+ assert status .input_ is None
725734 assert status .output == {"out" : 2 }
726735 assert status .custom_status == "cs"
727- assert status .to_json ()["runtimeStatus" ] == "Running"
736+ status_json = status .to_json ()
737+ assert status_json ["runtimeStatus" ] == "Completed"
738+ assert "input" not in status_json
739+ assert status_json ["output" ] == {"out" : 2 }
740+ assert status_json ["customStatus" ] == "cs"
741+ finally :
742+ await client .close ()
743+
744+
745+ async def test_get_status_show_input_includes_running_input ():
746+ client = _make_client ()
747+ try :
748+ with patch .object (client , "get_orchestration_state" ,
749+ new = AsyncMock (return_value = _fake_state ())):
750+ with pytest .warns (DeprecationWarning ):
751+ status = await client .get_status ("abc" , show_input = True )
752+ assert status .runtime_status == df .OrchestrationRuntimeStatus .Running
753+ assert status .input_ == {"in" : 1 }
754+ assert status .to_json ()["input" ] == {"in" : 1 }
755+ finally :
756+ await client .close ()
757+
758+
759+ async def test_get_status_failed_preserves_failure_output ():
760+ client = _make_client ()
761+ try :
762+ state = _fake_state (
763+ runtime_status = OrchestrationStatus .FAILED ,
764+ serialized_output = None ,
765+ failure_details = SimpleNamespace (message = "boom" ))
766+ with patch .object (client , "get_orchestration_state" ,
767+ new = AsyncMock (return_value = state )):
768+ with pytest .warns (DeprecationWarning ):
769+ status = await client .get_status ("abc" )
770+ assert status .output == "boom"
771+ status_json = status .to_json ()
772+ assert status_json ["runtimeStatus" ] == "Failed"
773+ assert status_json ["output" ] == "boom"
774+ assert status_json ["customStatus" ] == "cs"
775+ assert "input" not in status_json
728776 finally :
729777 await client .close ()
730778
@@ -752,6 +800,9 @@ async def test_get_status_all_returns_wrapped_list():
752800 statuses = await client .get_status_all ()
753801 assert len (statuses ) == 1
754802 assert statuses [0 ].runtime_status == df .OrchestrationRuntimeStatus .Running
803+ assert statuses [0 ].input_ == {"in" : 1 }
804+ assert statuses [0 ].output == {"out" : 2 }
805+ assert statuses [0 ].custom_status == "cs"
755806 finally :
756807 await client .close ()
757808
@@ -765,6 +816,9 @@ async def test_get_status_by_returns_wrapped_list():
765816 statuses = await client .get_status_by (
766817 runtime_status = [df .OrchestrationRuntimeStatus .Running ])
767818 assert statuses [0 ].instance_id == "abc"
819+ assert statuses [0 ].input_ == {"in" : 1 }
820+ assert statuses [0 ].output == {"out" : 2 }
821+ assert statuses [0 ].custom_status == "cs"
768822 finally :
769823 await client .close ()
770824
0 commit comments