From 81d5a16aa7adfeb8d6f2e16847dfdeed78b25a18 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Wed, 15 Oct 2025 12:29:37 -0400 Subject: [PATCH] fix: update model for StopDurableExecution --- src/aws_durable_execution_sdk_python_testing/executor.py | 4 ++-- src/aws_durable_execution_sdk_python_testing/model.py | 6 +++--- tests/executor_test.py | 2 +- tests/model_test.py | 8 ++++---- tests/web/handlers_test.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/aws_durable_execution_sdk_python_testing/executor.py b/src/aws_durable_execution_sdk_python_testing/executor.py index 77ce59a..1025ab0 100644 --- a/src/aws_durable_execution_sdk_python_testing/executor.py +++ b/src/aws_durable_execution_sdk_python_testing/executor.py @@ -312,7 +312,7 @@ def stop_execution( error: Optional error to use when stopping the execution Returns: - StopDurableExecutionResponse: Response containing stop date + StopDurableExecutionResponse: Response containing end timestamp Raises: ResourceNotFoundException: If execution does not exist @@ -333,7 +333,7 @@ def stop_execution( # Stop the execution self.fail_execution(execution_arn, stop_error) - return StopDurableExecutionResponse(stop_date=datetime.now(UTC).timestamp()) + return StopDurableExecutionResponse(end_timestamp=datetime.now(UTC).timestamp()) def get_execution_state( self, diff --git a/src/aws_durable_execution_sdk_python_testing/model.py b/src/aws_durable_execution_sdk_python_testing/model.py index 39ae665..af24767 100644 --- a/src/aws_durable_execution_sdk_python_testing/model.py +++ b/src/aws_durable_execution_sdk_python_testing/model.py @@ -325,14 +325,14 @@ def to_dict(self) -> dict[str, Any]: class StopDurableExecutionResponse: """Response from stopping a durable execution.""" - stop_date: float + end_timestamp: float @classmethod def from_dict(cls, data: dict) -> StopDurableExecutionResponse: - return cls(stop_date=data["StopDate"]) + return cls(end_timestamp=data["EndTimestamp"]) def to_dict(self) -> dict[str, Any]: - return {"StopDate": self.stop_date} + return {"EndTimestamp": self.end_timestamp} @dataclass(frozen=True) diff --git a/tests/executor_test.py b/tests/executor_test.py index a281703..7babe70 100644 --- a/tests/executor_test.py +++ b/tests/executor_test.py @@ -1860,7 +1860,7 @@ def test_stop_execution(executor, mock_store): mock_store.load.assert_called_once_with("test-arn") mock_fail.assert_called_once() - assert result.stop_date is not None + assert result.end_timestamp is not None def test_stop_execution_already_complete(executor, mock_store): diff --git a/tests/model_test.py b/tests/model_test.py index 94d8b92..4b8a8bd 100644 --- a/tests/model_test.py +++ b/tests/model_test.py @@ -317,8 +317,8 @@ def test_durable_execution_summary_serialization(): assert round_trip == summary_obj -def test_durable_execution_summary_no_stop_date(): - """Test Execution without stop date.""" +def test_durable_execution_summary_no_end_timestamp(): + """Test Execution without end timestamp.""" data = { "DurableExecutionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-function:execution:test", "DurableExecutionName": "test-execution", @@ -421,10 +421,10 @@ def test_stop_durable_execution_request_minimal(): def test_stop_durable_execution_response_serialization(): """Test StopDurableExecutionResponse from_dict/to_dict round-trip.""" - data = {"StopDate": "2023-01-01T00:01:00Z"} + data = {"EndTimestamp": "2023-01-01T00:01:00Z"} response_obj = StopDurableExecutionResponse.from_dict(data) - assert response_obj.stop_date == "2023-01-01T00:01:00Z" + assert response_obj.end_timestamp == "2023-01-01T00:01:00Z" result_data = response_obj.to_dict() assert result_data == data diff --git a/tests/web/handlers_test.py b/tests/web/handlers_test.py index 40bd966..15e3d8a 100644 --- a/tests/web/handlers_test.py +++ b/tests/web/handlers_test.py @@ -870,7 +870,7 @@ def test_stop_durable_execution_handler_success(): handler = StopDurableExecutionHandler(executor) # Mock the executor response - mock_response = StopDurableExecutionResponse(stop_date="2023-01-01T00:01:00Z") + mock_response = StopDurableExecutionResponse(end_timestamp="2023-01-01T00:01:00Z") executor.stop_execution.return_value = mock_response # Create request with proper stop data @@ -900,7 +900,7 @@ def test_stop_durable_execution_handler_success(): # Verify response assert response.status_code == 200 - assert response.body == {"StopDate": "2023-01-01T00:01:00Z"} + assert response.body == {"EndTimestamp": "2023-01-01T00:01:00Z"} # Verify executor was called with correct parameters executor.stop_execution.assert_called_once()