File tree Expand file tree Collapse file tree
packages/gooddata-sdk/tests/compute Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,23 +238,3 @@ def test_build_exec_def_from_chat_result(test_config):
238238 finally :
239239 sdk .catalog_workspace .delete_workspace (test_workspace_id )
240240 sdk .compute .reset_ai_chat_history (test_workspace_id )
241-
242-
243- @gd_vcr .use_cassette (str (_fixtures_dir / "ai_search_error_field.yaml" ))
244- def test_search_ai_error_field (test_config ):
245- """Test that SearchResult properly exposes the ErrorInfo error field.
246-
247- The error field is populated when search could not run (e.g. metadata sync
248- is in progress). It is absent on success. This test verifies that when the
249- API returns an error the SDK surfaces it correctly via result.error.
250- """
251- sdk = GoodDataSdk .create (host_ = test_config ["host" ], token_ = test_config ["token" ])
252- test_workspace_id = test_config ["workspace_test" ]
253-
254- result = sdk .compute .search_ai (test_workspace_id , "What is the total revenue?" )
255- # On success the error field is absent; on failure it carries structured info.
256- if result .error is not None :
257- assert isinstance (result .error .reason , str ), "error.reason must be a string"
258- assert isinstance (result .error .status_code , int ), "error.status_code must be an int"
259- else :
260- assert result .results is not None , "On success, results must be present"
Original file line number Diff line number Diff line change 1+ # (C) 2025 GoodData Corporation
2+ from pathlib import Path
3+
4+ from gooddata_sdk .sdk import GoodDataSdk
5+ from tests_support .vcrpy_utils import get_vcr
6+
7+ gd_vcr = get_vcr ()
8+
9+ _current_dir = Path (__file__ ).parent .absolute ()
10+ _fixtures_dir = _current_dir / "fixtures"
11+
12+
13+ @gd_vcr .use_cassette (str (_fixtures_dir / "ai_search_error_field.yaml" ))
14+ def test_search_ai_error_field (test_config ):
15+ """Test that SearchResult properly exposes the ErrorInfo error field.
16+
17+ The error field is populated when search could not run (e.g. metadata sync
18+ is in progress). It is absent on success. This test verifies that when the
19+ API returns an error the SDK surfaces it correctly via result.error.
20+ """
21+ sdk = GoodDataSdk .create (host_ = test_config ["host" ], token_ = test_config ["token" ])
22+ test_workspace_id = test_config ["workspace_test" ]
23+
24+ result = sdk .compute .search_ai (test_workspace_id , "What is the total revenue?" )
25+ # On success the error field is absent; on failure it carries structured info.
26+ if result .error is not None :
27+ assert isinstance (result .error .reason , str ), "error.reason must be a string"
28+ assert isinstance (result .error .status_code , int ), "error.status_code must be an int"
29+ else :
30+ assert result .results is not None , "On success, results must be present"
You can’t perform that action at this time.
0 commit comments