7777TIMESTAMP_2023_01_01_00_02 = datetime .datetime (2023 , 1 , 1 , 0 , 2 , 0 , tzinfo = datetime .UTC )
7878TIMESTAMP_2023_01_02_00_00 = datetime .datetime (2023 , 1 , 2 , 0 , 0 , 0 , tzinfo = datetime .UTC )
7979
80+ DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA = {
81+ "AccountId" : "123456789012" ,
82+ "FunctionName" : "my-function" ,
83+ "FunctionQualifier" : "$LATEST" ,
84+ "ExecutionName" : "test-execution" ,
85+ "ExecutionTimeoutSeconds" : 300 ,
86+ "ExecutionRetentionPeriodDays" : 7 ,
87+ "InvocationId" : "invocation-123" ,
88+ "TraceFields" : {"key" : "value" },
89+ "TenantId" : "tenant-123" ,
90+ "Input" : "test-input" ,
91+ }
92+
8093
8194def test_start_durable_execution_input_serialization ():
8295 """Test StartDurableExecutionInput from_dict/to_dict round-trip."""
83- data = {
84- "AccountId" : "123456789012" ,
85- "FunctionName" : "my-function" ,
86- "FunctionQualifier" : "$LATEST" ,
87- "ExecutionName" : "test-execution" ,
88- "ExecutionTimeoutSeconds" : 300 ,
89- "ExecutionRetentionPeriodDays" : 7 ,
90- "InvocationId" : "invocation-123" ,
91- "TraceFields" : {"key" : "value" },
92- "TenantId" : "tenant-123" ,
93- "Input" : "test-input" ,
94- }
96+ data = DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA
9597
9698 # Test from_dict
9799 input_obj = StartDurableExecutionInput .from_dict (data )
@@ -115,6 +117,42 @@ def test_start_durable_execution_input_serialization():
115117 assert round_trip == input_obj
116118
117119
120+ def test_start_durable_execution_input_get_input_json_input ():
121+ """Test StartDurableExecutionInput from_dict/to_dict round-trip."""
122+ data = DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA
123+ data ["Input" ] = '{"message": "hello"}'
124+
125+ input_obj = StartDurableExecutionInput .from_dict (data )
126+ assert '{"message": "hello"}' == input_obj .get_normalized_input ()
127+
128+
129+ def test_start_durable_execution_input_get_input_str_non_json_input ():
130+ """Test StartDurableExecutionInput from_dict/to_dict round-trip."""
131+ data = DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA
132+ data ["Input" ] = "hello"
133+
134+ input_obj = StartDurableExecutionInput .from_dict (data )
135+ assert '"hello"' == input_obj .get_normalized_input ()
136+
137+
138+ def test_start_durable_execution_input_get_input_str_json_input ():
139+ """Test StartDurableExecutionInput from_dict/to_dict round-trip."""
140+ data = DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA
141+ data ["Input" ] = '"hello"'
142+
143+ input_obj = StartDurableExecutionInput .from_dict (data )
144+ assert '"hello"' == input_obj .get_normalized_input ()
145+
146+
147+ def test_start_durable_execution_input_get_input_list_json_input ():
148+ """Test StartDurableExecutionInput from_dict/to_dict round-trip."""
149+ data = DEFAULT_START_DURABLE_EXECUTION_INPUT_DATA
150+ data ["Input" ] = "[1,2,3]"
151+
152+ input_obj = StartDurableExecutionInput .from_dict (data )
153+ assert "[1,2,3]" == input_obj .get_normalized_input ()
154+
155+
118156def test_start_durable_execution_input_minimal ():
119157 """Test StartDurableExecutionInput with only required fields."""
120158 data = {
0 commit comments