@@ -894,8 +894,8 @@ def test_get_columns(self, sea_client, sea_session_id, mock_cursor):
894894 )
895895 assert "Catalog name is required for get_columns" in str (excinfo .value )
896896
897- def test_get_chunk_link (self , sea_client , mock_http_client , sea_command_id ):
898- """Test get_chunk_link method."""
897+ def test_get_chunk_links (self , sea_client , mock_http_client , sea_command_id ):
898+ """Test get_chunk_links method when links are available ."""
899899 # Setup mock response
900900 mock_response = {
901901 "external_links" : [
@@ -914,7 +914,7 @@ def test_get_chunk_link(self, sea_client, mock_http_client, sea_command_id):
914914 mock_http_client ._make_request .return_value = mock_response
915915
916916 # Call the method
917- result = sea_client .get_chunk_link ("test-statement-123" , 0 )
917+ results = sea_client .get_chunk_links ("test-statement-123" , 0 )
918918
919919 # Verify the HTTP client was called correctly
920920 mock_http_client ._make_request .assert_called_once_with (
@@ -924,7 +924,10 @@ def test_get_chunk_link(self, sea_client, mock_http_client, sea_command_id):
924924 ),
925925 )
926926
927- # Verify the result
927+ # Verify the results
928+ assert isinstance (results , list )
929+ assert len (results ) == 1
930+ result = results [0 ]
928931 assert result .external_link == "https://example.com/data/chunk0"
929932 assert result .expiration == "2025-07-03T05:51:18.118009"
930933 assert result .row_count == 100
@@ -934,30 +937,14 @@ def test_get_chunk_link(self, sea_client, mock_http_client, sea_command_id):
934937 assert result .next_chunk_index == 1
935938 assert result .http_headers == {"Authorization" : "Bearer token123" }
936939
937- def test_get_chunk_link_not_found (self , sea_client , mock_http_client ):
938- """Test get_chunk_link when the requested chunk is not found ."""
940+ def test_get_chunk_links_empty (self , sea_client , mock_http_client ):
941+ """Test get_chunk_links when no links are returned (empty list) ."""
939942 # Setup mock response with no matching chunk
940- mock_response = {
941- "external_links" : [
942- {
943- "external_link" : "https://example.com/data/chunk1" ,
944- "expiration" : "2025-07-03T05:51:18.118009" ,
945- "row_count" : 100 ,
946- "byte_count" : 1024 ,
947- "row_offset" : 100 ,
948- "chunk_index" : 1 , # Different chunk index
949- "next_chunk_index" : 2 ,
950- "http_headers" : {"Authorization" : "Bearer token123" },
951- }
952- ]
953- }
943+ mock_response = {"external_links" : []}
954944 mock_http_client ._make_request .return_value = mock_response
955945
956- # Call the method and expect an exception
957- with pytest .raises (
958- ServerOperationError , match = "No link found for chunk index 0"
959- ):
960- sea_client .get_chunk_link ("test-statement-123" , 0 )
946+ # Call the method
947+ results = sea_client .get_chunk_links ("test-statement-123" , 0 )
961948
962949 # Verify the HTTP client was called correctly
963950 mock_http_client ._make_request .assert_called_once_with (
@@ -966,3 +953,7 @@ def test_get_chunk_link_not_found(self, sea_client, mock_http_client):
966953 "test-statement-123" , 0
967954 ),
968955 )
956+
957+ # Verify the results are empty
958+ assert isinstance (results , list )
959+ assert results == []
0 commit comments