Skip to content

Commit 6443c24

Browse files
committed
fix(tests): update S3Error instantiation in unit tests for proper mocking
1 parent a0d5c0a commit 6443c24

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎tests/extensibility/unit/test_client.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ def _success_payload(workflow_id: str = "wf-001") -> str:
277277
"json": {
278278
"message_id": "msg-1",
279279
"context_id": "ctx-1",
280-
"role": 2,
280+
"role": "agent",
281+
"parts": [{"kind": "text", "text": ""}],
281282
}
282283
}
283284
]
@@ -311,7 +312,8 @@ def _poll_success_payload() -> str:
311312
"json": {
312313
"message_id": "msg-2",
313314
"context_id": "ctx-1",
314-
"role": 2,
315+
"role": "agent",
316+
"parts": [{"kind": "text", "text": ""}],
315317
}
316318
}
317319
]

‎tests/objectstore/unit/test_s3_client.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_get_object_success(self, mock_minio_class):
175175
@patch('sap_cloud_sdk.objectstore._s3.Minio')
176176
def test_get_object_not_found(self, mock_minio_class):
177177
mock_minio = Mock()
178-
s3_error = S3Error("NoSuchKey", "Key not found", "test.txt", "123", "456", Mock())
178+
s3_error = S3Error(Mock(), "NoSuchKey", "Key not found", "test.txt", "123", "456")
179179
mock_minio.get_object.side_effect = s3_error
180180
mock_minio_class.return_value = mock_minio
181181

@@ -200,7 +200,7 @@ def test_delete_object_success(self, mock_minio_class):
200200
@patch('sap_cloud_sdk.objectstore._s3.Minio')
201201
def test_delete_object_not_found_ignored(self, mock_minio_class):
202202
mock_minio = Mock()
203-
s3_error = S3Error("NoSuchKey", "Key not found", "test.txt", "123", "456", Mock())
203+
s3_error = S3Error(Mock(), "NoSuchKey", "Key not found", "test.txt", "123", "456")
204204
mock_minio.remove_object.side_effect = s3_error
205205
mock_minio_class.return_value = mock_minio
206206

@@ -273,7 +273,7 @@ def test_head_object_success(self, mock_minio_class):
273273
@patch('sap_cloud_sdk.objectstore._s3.Minio')
274274
def test_head_object_not_found(self, mock_minio_class):
275275
mock_minio = Mock()
276-
s3_error = S3Error("NoSuchKey", "Key not found", "test.txt", "123", "456", Mock())
276+
s3_error = S3Error(Mock(), "NoSuchKey", "Key not found", "test.txt", "123", "456")
277277
mock_minio.stat_object.side_effect = s3_error
278278
mock_minio_class.return_value = mock_minio
279279

@@ -296,7 +296,7 @@ def test_object_exists_true(self, mock_minio_class):
296296
@patch('sap_cloud_sdk.objectstore._s3.Minio')
297297
def test_object_exists_false(self, mock_minio_class):
298298
mock_minio = Mock()
299-
s3_error = S3Error("NoSuchKey", "Key not found", "test.txt", "123", "456", Mock())
299+
s3_error = S3Error(Mock(), "NoSuchKey", "Key not found", "test.txt", "123", "456")
300300
mock_minio.stat_object.side_effect = s3_error
301301
mock_minio_class.return_value = mock_minio
302302

0 commit comments

Comments
 (0)