Skip to content

Commit 3cf771b

Browse files
introduce unit test to ensure correct assignment of is_staging_op
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 280ed22 commit 3cf771b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/unit/test_sea_backend.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,31 @@ def test_utility_methods(self, sea_client):
633633
sea_client._extract_description_from_manifest(no_columns_manifest) is None
634634
)
635635

636+
def test_results_message_to_execute_response_is_staging_operation(self, sea_client):
637+
"""Test that is_staging_operation is correctly set from manifest.is_volume_operation."""
638+
# Test when is_volume_operation is True
639+
response = MagicMock()
640+
response.statement_id = "test-statement-123"
641+
response.status.state = CommandState.SUCCEEDED
642+
response.manifest.is_volume_operation = True
643+
response.manifest.result_compression = "NONE"
644+
response.manifest.format = "JSON_ARRAY"
645+
646+
# Mock the _extract_description_from_manifest method to return None
647+
with patch.object(
648+
sea_client, "_extract_description_from_manifest", return_value=None
649+
):
650+
result = sea_client._results_message_to_execute_response(response)
651+
assert result.is_staging_operation is True
652+
653+
# Test when is_volume_operation is False
654+
response.manifest.is_volume_operation = False
655+
with patch.object(
656+
sea_client, "_extract_description_from_manifest", return_value=None
657+
):
658+
result = sea_client._results_message_to_execute_response(response)
659+
assert result.is_staging_operation is False
660+
636661
def test_get_catalogs(self, sea_client, sea_session_id, mock_cursor):
637662
"""Test the get_catalogs method."""
638663
# Mock the execute_command method

0 commit comments

Comments
 (0)