Skip to content

Commit 3171477

Browse files
committed
feat: POC automation test for AI using python
JIRA: QA-23855 risk: nonprod
1 parent 40b351c commit 3171477

27 files changed

+1023
-1
lines changed

gooddata-sdk/gooddata_sdk/compute/service.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,21 @@ def ai_chat_history_reset(self, workspace_id: str) -> None:
105105
Args:
106106
workspace_id: workspace identifier
107107
"""
108-
chat_history_request = ChatHistoryRequest(reset=True)
108+
chat_history_request = ChatHistoryRequest(
109+
reset=True,
110+
)
111+
self._actions_api.ai_chat_history(workspace_id, chat_history_request, _check_return_type=False)
112+
113+
def ai_chat_history_user_feedback(
114+
self, workspace_id: str, chat_history_interaction_id: int = 0, user_feedback: str = "POSITIVE"
115+
) -> None:
116+
"""
117+
Reset chat history with AI in GoodData workspace.
118+
119+
Args:
120+
workspace_id: workspace identifier
121+
"""
122+
chat_history_request = ChatHistoryRequest(
123+
chat_history_interaction_id=chat_history_interaction_id, user_feedback=user_feedback
124+
)
109125
self._actions_api.ai_chat_history(workspace_id, chat_history_request, _check_return_type=False)

integration_tests/.env.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# (C) 2024 GoodData Corporation
2+
HOST=
3+
TOKEN=
4+
DATASOURCE_ID=
5+
WORKSPACE_ID=
6+
LLM_TOKEN=

integration_tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# (C) 2021 GoodData Corporation
189 Bytes
Binary file not shown.
2.18 KB
Binary file not shown.

integration_tests/conftest.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# (C) 2024 GoodData Corporation
2+
# filepath: /Users/tubui/Documents/CODE/gooddata-python-sdk-1/gooddata-sdk/integration_tests/scripts/conftest.py
3+
import os
4+
5+
import pytest
6+
from dotenv import load_dotenv
7+
8+
# Load the .env file from the current directory
9+
load_dotenv()
10+
11+
12+
@pytest.fixture(scope="session", autouse=True)
13+
def setup_env():
14+
# Ensure that the environment variables are set
15+
os.environ["HOST"] = os.getenv("HOST", "https://checklist.staging.stg11.panther.intgdc.com")
16+
os.environ["TOKEN"] = os.getenv("TOKEN", "")
17+
os.environ["DATASOURCE_ID"] = os.getenv("DATASOURCE_ID", "")
18+
os.environ["WORKSPACE_ID"] = os.getenv("WORKSPACE_ID", "")
19+
os.environ["DATASOURCE_TYPE"] = os.getenv("DATASOURCE_TYPE", "")
20+
os.environ["DATASOURCE_PASSWORD"] = os.getenv("DATASOURCE_PASSWORD", "")
21+
22+
# Check if the necessary environment variables are set
23+
if not os.environ["HOST"]:
24+
raise OSError("\nHOST environment variable is not set.")
25+
if not os.environ["TOKEN"]:
26+
raise OSError("\nTOKEN environment variable is not set.")
27+
if not os.environ["DATASOURCE_ID"]:
28+
print("\nWarning: DATA_SOURCE_ID environment variable is not set.")
29+
if not os.environ["WORKSPACE_ID"]:
30+
print("\nWarning: WORKSPACE_ID environment variable is not set.")
31+
if not os.environ["DATASOURCE_TYPE"]:
32+
print("\nWarning: DATASOURCE_TYPE environment variable is not set.")
33+
if not os.environ["DATASOURCE_PASSWORD"]:
34+
print("\nWarning: DATASOURCE_PASSWORD environment variable is not set.")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"id": "total_returns_per_month",
3+
"title": "Total Returns per Month",
4+
"visualizationType": "COLUMN",
5+
"metrics": [
6+
{
7+
"id": "total_returns",
8+
"type": "metric",
9+
"title": "Total Returns"
10+
}
11+
],
12+
"dimensionality": [
13+
{
14+
"id": "return_date.month",
15+
"type": "attribute",
16+
"title": "Return date - Month/Year"
17+
}
18+
],
19+
"filters": [],
20+
"suggestions": [
21+
{
22+
"query": "Switch to a line chart to better visualize the trend of total returns over the months.",
23+
"label": "Line Chart for Trends"
24+
},
25+
{
26+
"query": "Filter the data to show total returns for this year only.",
27+
"label": "This Year's Returns"
28+
}
29+
]
30+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"id": "number_of_order_ids",
3+
"title": "Number of Order IDs",
4+
"visualizationType": "HEADLINE",
5+
"metrics": [
6+
{
7+
"id": "order_id",
8+
"type": "attribute",
9+
"title": "Number of Order IDs",
10+
"aggFunction": "COUNT"
11+
}
12+
],
13+
"dimensionality": [],
14+
"filters": [],
15+
"suggestions": [
16+
{
17+
"query": "Show the number of orders by year",
18+
"label": "Show by Year"
19+
}
20+
]
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"question": "What is number of order id, show as HEADLINE chart?",
4+
"expected_objects_file": "headline_count_of_order.json"
5+
},
6+
{
7+
"question": "What is total returns per month? show as COLUMN chart",
8+
"expected_objects_file": "column_total_returns_by_month.json"
9+
}
10+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# (C) 2021 GoodData Corporation

0 commit comments

Comments
 (0)