codemie-test-harness 0.1.180__py3-none-any.whl → 0.1.181__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of codemie-test-harness might be problematic. Click here for more details.
- codemie_test_harness/tests/assistant/datasource/test_code_datasource.py +17 -4
- codemie_test_harness/tests/assistant/datasource/test_confluence_datasource.py +17 -4
- codemie_test_harness/tests/assistant/datasource/test_file_indexing.py +15 -4
- codemie_test_harness/tests/assistant/datasource/test_google_datasource.py +18 -4
- codemie_test_harness/tests/assistant/datasource/test_jira_datasource.py +19 -6
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool.py +21 -5
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool_kit.py +21 -5
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool_with_datasource.py +21 -5
- codemie_test_harness/tests/assistant/test_assistants.py +31 -13
- codemie_test_harness/tests/assistant/tools/access_management/test_keycloak_tool.py +6 -1
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_test_plan_tools.py +37 -9
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_wiki_tools.py +25 -6
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_work_item_tools.py +25 -5
- codemie_test_harness/tests/assistant/tools/cloud/test_cloud_tools.py +8 -2
- codemie_test_harness/tests/assistant/tools/codebase/test_codebase_tools.py +11 -2
- codemie_test_harness/tests/assistant/tools/datamanagement/test_assistant_with_data_management_tools.py +30 -9
- codemie_test_harness/tests/assistant/tools/filemanagement/test_assistant_with_file_management_tools.py +33 -8
- codemie_test_harness/tests/assistant/tools/git/test_assistant_with_git_tools.py +41 -10
- codemie_test_harness/tests/assistant/tools/mcp/test_cli_mcp_server.py +14 -7
- codemie_test_harness/tests/assistant/tools/mcp/test_mcp_servers.py +12 -6
- codemie_test_harness/tests/assistant/tools/notification/test_assistant_notification_tools.py +9 -2
- codemie_test_harness/tests/assistant/tools/openapi/test_assistant_with_open_api_tools.py +5 -1
- codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_development_plugin.py +25 -6
- codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_plugin_and_mcp_servers.py +15 -3
- codemie_test_harness/tests/assistant/tools/plugin/test_single_assistant_dual_time_plugins.py +11 -2
- codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py +30 -11
- codemie_test_harness/tests/assistant/tools/report_portal/test_assistant_report_portal_tools.py +6 -1
- codemie_test_harness/tests/assistant/tools/research/test_assistant_research_tools.py +15 -3
- codemie_test_harness/tests/assistant/tools/servicenow/test_servicenow_tools.py +5 -1
- codemie_test_harness/tests/assistant/tools/vcs/test_assistant_with_vcs_tools.py +6 -1
- codemie_test_harness/tests/enums/tools.py +32 -0
- codemie_test_harness/tests/test_data/file_test_data.py +17 -0
- codemie_test_harness/tests/utils/assistant_utils.py +34 -1
- codemie_test_harness/tests/utils/base_utils.py +61 -0
- {codemie_test_harness-0.1.180.dist-info → codemie_test_harness-0.1.181.dist-info}/METADATA +2 -2
- {codemie_test_harness-0.1.180.dist-info → codemie_test_harness-0.1.181.dist-info}/RECORD +38 -38
- {codemie_test_harness-0.1.180.dist-info → codemie_test_harness-0.1.181.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.180.dist-info → codemie_test_harness-0.1.181.dist-info}/entry_points.txt +0 -0
|
@@ -10,7 +10,10 @@ from codemie_test_harness.tests.test_data.ado_wiki_tools_test_data import (
|
|
|
10
10
|
ADO_WIKI_DELETE_PAGE,
|
|
11
11
|
)
|
|
12
12
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
13
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
13
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
14
|
+
get_random_name,
|
|
15
|
+
assert_tool_triggered,
|
|
16
|
+
)
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
@pytest.mark.assistant
|
|
@@ -41,7 +44,11 @@ def test_assistant_with_ado_wiki_get_tools(
|
|
|
41
44
|
settings=settings,
|
|
42
45
|
)
|
|
43
46
|
|
|
44
|
-
response = assistant_utils.ask_assistant(
|
|
47
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
48
|
+
assistant, prompt, minimal_response=False
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
45
52
|
similarity_check.check_similarity(response, expected_response)
|
|
46
53
|
|
|
47
54
|
|
|
@@ -72,7 +79,10 @@ def test_assistant_with_ado_wiki_modify_tools(
|
|
|
72
79
|
# 1. Create the page
|
|
73
80
|
create_prompt = ADO_WIKI_CREATE_PAGE["prompt_to_assistant"].format(page_title)
|
|
74
81
|
create_expected = ADO_WIKI_CREATE_PAGE["expected_llm_answer"].format(page_title)
|
|
75
|
-
response = assistant_utils.ask_assistant(
|
|
82
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
83
|
+
assistant, create_prompt, minimal_response=False
|
|
84
|
+
)
|
|
85
|
+
assert_tool_triggered(AzureDevOpsWikiTool.MODIFY_WIKI_PAGE, triggered_tools)
|
|
76
86
|
similarity_check.check_similarity(response, create_expected)
|
|
77
87
|
|
|
78
88
|
# 2. Rename the page
|
|
@@ -82,7 +92,10 @@ def test_assistant_with_ado_wiki_modify_tools(
|
|
|
82
92
|
rename_expected = ADO_WIKI_RENAME_PAGE["expected_llm_answer"].format(
|
|
83
93
|
page_title, page_title
|
|
84
94
|
)
|
|
85
|
-
response = assistant_utils.ask_assistant(
|
|
95
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
96
|
+
assistant, rename_prompt, minimal_response=False
|
|
97
|
+
)
|
|
98
|
+
assert_tool_triggered(AzureDevOpsWikiTool.RENAME_WIKI_PAGE, triggered_tools)
|
|
86
99
|
similarity_check.check_similarity(response, rename_expected)
|
|
87
100
|
|
|
88
101
|
# 3. Modify the page
|
|
@@ -92,7 +105,10 @@ def test_assistant_with_ado_wiki_modify_tools(
|
|
|
92
105
|
modify_expected = ADO_WIKI_MODIFY_PAGE["expected_llm_answer"].format(
|
|
93
106
|
page_title + "-Updated"
|
|
94
107
|
)
|
|
95
|
-
response = assistant_utils.ask_assistant(
|
|
108
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
109
|
+
assistant, modify_prompt, minimal_response=False
|
|
110
|
+
)
|
|
111
|
+
assert_tool_triggered(AzureDevOpsWikiTool.MODIFY_WIKI_PAGE, triggered_tools)
|
|
96
112
|
similarity_check.check_similarity(response, modify_expected)
|
|
97
113
|
|
|
98
114
|
# 4. Delete the page
|
|
@@ -102,5 +118,8 @@ def test_assistant_with_ado_wiki_modify_tools(
|
|
|
102
118
|
delete_expected = ADO_WIKI_DELETE_PAGE["expected_llm_answer"].format(
|
|
103
119
|
page_title + "-Updated"
|
|
104
120
|
)
|
|
105
|
-
response = assistant_utils.ask_assistant(
|
|
121
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
122
|
+
assistant, delete_prompt, minimal_response=False
|
|
123
|
+
)
|
|
124
|
+
assert_tool_triggered(AzureDevOpsWikiTool.DELETE_WIKI_PAGE_BY_PATH, triggered_tools)
|
|
106
125
|
similarity_check.check_similarity(response, delete_expected)
|
|
@@ -9,7 +9,10 @@ from codemie_test_harness.tests.test_data.ado_work_item_tools_test_data import (
|
|
|
9
9
|
ADO_WORK_ITEM_LINK,
|
|
10
10
|
)
|
|
11
11
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
12
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
12
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
13
|
+
get_random_name,
|
|
14
|
+
assert_tool_triggered,
|
|
15
|
+
)
|
|
13
16
|
from codemie_test_harness.tests.utils.constants import WORK_ITEM_ID_PATTERN
|
|
14
17
|
from codemie_test_harness.tests.utils.json_utils import extract_id_from_ado_response
|
|
15
18
|
|
|
@@ -42,7 +45,11 @@ def test_assistant_with_ado_work_item_get_tools(
|
|
|
42
45
|
settings=settings,
|
|
43
46
|
)
|
|
44
47
|
|
|
45
|
-
response = assistant_utils.ask_assistant(
|
|
48
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
49
|
+
assistant, prompt, minimal_response=False
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
46
53
|
similarity_check.check_similarity(response, expected_response)
|
|
47
54
|
|
|
48
55
|
|
|
@@ -72,29 +79,42 @@ def test_assistant_with_ado_work_item_modify_tools(
|
|
|
72
79
|
work_item_title = f"Autotest Task {get_random_name()}"
|
|
73
80
|
|
|
74
81
|
create_prompt = ADO_WORK_ITEM_CREATE["prompt_to_assistant"].format(work_item_title)
|
|
75
|
-
create_response = assistant_utils.ask_assistant(
|
|
82
|
+
create_response, create_triggered_tools = assistant_utils.ask_assistant(
|
|
83
|
+
assistant, create_prompt, minimal_response=False
|
|
84
|
+
)
|
|
76
85
|
|
|
77
86
|
work_item_id = extract_id_from_ado_response(create_response, WORK_ITEM_ID_PATTERN)
|
|
78
87
|
create_expected = ADO_WORK_ITEM_CREATE["expected_llm_answer"].format(
|
|
79
88
|
work_item_title
|
|
80
89
|
)
|
|
90
|
+
assert_tool_triggered(
|
|
91
|
+
AzureDevOpsWorkItemTool.CREATE_WORK_ITEM, create_triggered_tools
|
|
92
|
+
)
|
|
81
93
|
similarity_check.check_similarity(create_response, create_expected)
|
|
82
94
|
|
|
83
95
|
new_title = f"Autotest Epic {get_random_name()}"
|
|
84
96
|
update_prompt = ADO_WORK_ITEM_UPDATE["prompt_to_assistant"].format(
|
|
85
97
|
work_item_id, new_title
|
|
86
98
|
)
|
|
87
|
-
update_response = assistant_utils.ask_assistant(
|
|
99
|
+
update_response, update_triggered_tools = assistant_utils.ask_assistant(
|
|
100
|
+
assistant, update_prompt, minimal_response=False
|
|
101
|
+
)
|
|
88
102
|
|
|
89
103
|
update_expected = ADO_WORK_ITEM_UPDATE["expected_llm_answer"].format(
|
|
90
104
|
work_item_id, new_title
|
|
91
105
|
)
|
|
106
|
+
assert_tool_triggered(
|
|
107
|
+
AzureDevOpsWorkItemTool.UPDATE_WORK_ITEM, update_triggered_tools
|
|
108
|
+
)
|
|
92
109
|
similarity_check.check_similarity(update_response, update_expected)
|
|
93
110
|
|
|
94
111
|
link_prompt = ADO_WORK_ITEM_LINK["prompt_to_assistant"].format(
|
|
95
112
|
work_item_id, work_item_id
|
|
96
113
|
)
|
|
97
|
-
link_response = assistant_utils.ask_assistant(
|
|
114
|
+
link_response, link_triggered_tools = assistant_utils.ask_assistant(
|
|
115
|
+
assistant, link_prompt, minimal_response=False
|
|
116
|
+
)
|
|
98
117
|
|
|
99
118
|
link_expected = ADO_WORK_ITEM_LINK["expected_llm_answer"].format(work_item_id)
|
|
119
|
+
assert_tool_triggered(AzureDevOpsWorkItemTool.LINK_WORK_ITEMS, link_triggered_tools)
|
|
100
120
|
similarity_check.check_similarity(link_response, link_expected)
|
|
@@ -2,6 +2,8 @@ import pytest
|
|
|
2
2
|
|
|
3
3
|
from codemie_test_harness.tests.test_data.cloud_tools_test_data import cloud_test_data
|
|
4
4
|
|
|
5
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
@pytest.mark.assistant
|
|
7
9
|
@pytest.mark.cloud
|
|
@@ -24,8 +26,12 @@ def test_assistant_with_cloud_tools(
|
|
|
24
26
|
):
|
|
25
27
|
settings = integration_utils.create_integration(credential_type, credentials)
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
cloud_assistant = assistant(toolkit, tool_name, settings=settings)
|
|
30
|
+
|
|
31
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
32
|
+
cloud_assistant, prompt, minimal_response=False
|
|
33
|
+
)
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
30
36
|
|
|
31
37
|
similarity_check.check_similarity(response, expected_response)
|
|
@@ -8,6 +8,7 @@ from codemie_test_harness.tests.test_data.codebase_tools_test_data import (
|
|
|
8
8
|
code_tools_test_data,
|
|
9
9
|
sonar_tools_test_data,
|
|
10
10
|
)
|
|
11
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
@pytest.mark.assistant
|
|
@@ -30,7 +31,11 @@ def test_assistant_with_codebase_tools(
|
|
|
30
31
|
expected_response,
|
|
31
32
|
):
|
|
32
33
|
assistant = assistant(toolkit, tool_name, context=code_context(code_datasource))
|
|
33
|
-
response = assistant_utils.ask_assistant(
|
|
34
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
35
|
+
assistant, prompt, minimal_response=False
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
34
39
|
similarity_check.check_similarity(response, expected_response)
|
|
35
40
|
|
|
36
41
|
|
|
@@ -60,5 +65,9 @@ def test_assistant_with_sonar_tools(
|
|
|
60
65
|
settings=settings,
|
|
61
66
|
)
|
|
62
67
|
|
|
63
|
-
response = assistant_utils.ask_assistant(
|
|
68
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
69
|
+
assistant, prompt, minimal_response=False
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
64
73
|
similarity_check.check_similarity(response, expected)
|
|
@@ -19,6 +19,7 @@ from codemie_test_harness.tests.test_data.data_management_tools_test_data import
|
|
|
19
19
|
)
|
|
20
20
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
21
21
|
from codemie_test_harness.tests.utils.env_resolver import EnvironmentResolver
|
|
22
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
22
23
|
|
|
23
24
|
pytestmark = pytest.mark.skipif(
|
|
24
25
|
EnvironmentResolver.is_localhost(),
|
|
@@ -43,8 +44,11 @@ def test_create_assistant_with_elastic_tool(
|
|
|
43
44
|
settings=settings,
|
|
44
45
|
)
|
|
45
46
|
|
|
46
|
-
response = assistant_utils.ask_assistant(
|
|
47
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
48
|
+
assistant, ELASTIC_TOOL_TASK, minimal_response=False
|
|
49
|
+
)
|
|
47
50
|
|
|
51
|
+
assert_tool_triggered(DataManagementTool.ELASTIC, triggered_tools)
|
|
48
52
|
similarity_check.check_similarity(response, RESPONSE_FOR_ELASTIC)
|
|
49
53
|
|
|
50
54
|
|
|
@@ -71,19 +75,36 @@ def test_create_assistant_with_sql_tool(
|
|
|
71
75
|
|
|
72
76
|
conversation_id = str(uuid.uuid4())
|
|
73
77
|
|
|
74
|
-
assistant_utils.ask_assistant(
|
|
75
|
-
assistant,
|
|
78
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
79
|
+
assistant,
|
|
80
|
+
SQL_TOOL_CREATE_TABLE_TASK,
|
|
81
|
+
conversation_id=conversation_id,
|
|
82
|
+
minimal_response=False,
|
|
76
83
|
)
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
assert_tool_triggered(DataManagementTool.SQL, triggered_tools)
|
|
85
|
+
|
|
86
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
87
|
+
assistant,
|
|
88
|
+
SQL_TOOL_INSERT_TABLE_TASK,
|
|
89
|
+
conversation_id=conversation_id,
|
|
90
|
+
minimal_response=False,
|
|
79
91
|
)
|
|
92
|
+
assert_tool_triggered(DataManagementTool.SQL, triggered_tools)
|
|
80
93
|
|
|
81
|
-
response = assistant_utils.ask_assistant(
|
|
82
|
-
assistant,
|
|
94
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
95
|
+
assistant,
|
|
96
|
+
SQL_TOOL_QUERY_TABLE_TASK,
|
|
97
|
+
conversation_id=conversation_id,
|
|
98
|
+
minimal_response=False,
|
|
83
99
|
)
|
|
100
|
+
assert_tool_triggered(DataManagementTool.SQL, triggered_tools)
|
|
84
101
|
|
|
85
|
-
assistant_utils.ask_assistant(
|
|
86
|
-
assistant,
|
|
102
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
103
|
+
assistant,
|
|
104
|
+
SQL_TOOL_DELETE_TABLE_TASK,
|
|
105
|
+
conversation_id=conversation_id,
|
|
106
|
+
minimal_response=False,
|
|
87
107
|
)
|
|
108
|
+
assert_tool_triggered(DataManagementTool.SQL, triggered_tools)
|
|
88
109
|
|
|
89
110
|
similarity_check.check_similarity(response, RESPONSE_FOR_SQL)
|
|
@@ -14,7 +14,10 @@ from codemie_test_harness.tests.test_data.file_management_tools_test_data import
|
|
|
14
14
|
file_editing_tools_test_data,
|
|
15
15
|
show_diff_task,
|
|
16
16
|
)
|
|
17
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
17
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
18
|
+
get_random_name,
|
|
19
|
+
assert_tool_triggered,
|
|
20
|
+
)
|
|
18
21
|
from codemie_test_harness.tests.utils.env_resolver import EnvironmentResolver
|
|
19
22
|
|
|
20
23
|
|
|
@@ -39,8 +42,11 @@ def test_create_assistant_with_file_management_tool(
|
|
|
39
42
|
Toolkit.FILE_MANAGEMENT, tool_name, settings=filesystem_integration
|
|
40
43
|
)
|
|
41
44
|
|
|
42
|
-
response = assistant_utils.ask_assistant(
|
|
45
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
46
|
+
assistant, prompt, minimal_response=False
|
|
47
|
+
)
|
|
43
48
|
|
|
49
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
44
50
|
similarity_check.check_similarity(response, expected_response)
|
|
45
51
|
|
|
46
52
|
|
|
@@ -60,7 +66,11 @@ def test_create_assistant_with_file_management_generate_image_tool(
|
|
|
60
66
|
settings=filesystem_integration,
|
|
61
67
|
)
|
|
62
68
|
|
|
63
|
-
response = assistant_utils.ask_assistant(
|
|
69
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
70
|
+
assistant, GENERATE_IMAGE_TOOL_TASK, minimal_response=False
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
assert_tool_triggered(FileManagementTool.GENERATE_IMAGE, triggered_tools)
|
|
64
74
|
|
|
65
75
|
assert_that(
|
|
66
76
|
response.lower(),
|
|
@@ -84,9 +94,15 @@ def test_create_assistant_with_file_management_read_file_tool(
|
|
|
84
94
|
settings=filesystem_integration,
|
|
85
95
|
)
|
|
86
96
|
|
|
87
|
-
assistant_utils.ask_assistant(
|
|
97
|
+
_, write_triggered_tools = assistant_utils.ask_assistant(
|
|
98
|
+
assistant, WRITE_FILE_TASK, minimal_response=False
|
|
99
|
+
)
|
|
100
|
+
assert_tool_triggered(FileManagementTool.WRITE_FILE, write_triggered_tools)
|
|
88
101
|
|
|
89
|
-
response = assistant_utils.ask_assistant(
|
|
102
|
+
response, read_triggered_tools = assistant_utils.ask_assistant(
|
|
103
|
+
assistant, READ_FILE_TOOL_TASK, minimal_response=False
|
|
104
|
+
)
|
|
105
|
+
assert_tool_triggered(FileManagementTool.READ_FILE, read_triggered_tools)
|
|
90
106
|
|
|
91
107
|
similarity_check.check_similarity(response, RESPONSE_FOR_READ_FILE_TASK)
|
|
92
108
|
|
|
@@ -115,9 +131,15 @@ def test_create_assistant_with_file_management_file_editing_tool(
|
|
|
115
131
|
settings=filesystem_integration,
|
|
116
132
|
)
|
|
117
133
|
file_to_update = f"sum_{get_random_name()}.py"
|
|
118
|
-
assistant_utils.ask_assistant(
|
|
134
|
+
_, create_triggered_tools = assistant_utils.ask_assistant(
|
|
135
|
+
assistant, create_file_task(file_to_update), minimal_response=False
|
|
136
|
+
)
|
|
137
|
+
assert_tool_triggered(tool_name, create_triggered_tools)
|
|
119
138
|
|
|
120
|
-
assistant_utils.ask_assistant(
|
|
139
|
+
_, insert_triggered_tools = assistant_utils.ask_assistant(
|
|
140
|
+
assistant, insert_to_file_task(file_to_update), minimal_response=False
|
|
141
|
+
)
|
|
142
|
+
assert_tool_triggered(tool_name, insert_triggered_tools)
|
|
121
143
|
|
|
122
144
|
prompt = (
|
|
123
145
|
show_file_task(file_to_update)
|
|
@@ -125,6 +147,9 @@ def test_create_assistant_with_file_management_file_editing_tool(
|
|
|
125
147
|
else show_diff_task(file_to_update)
|
|
126
148
|
)
|
|
127
149
|
|
|
128
|
-
response = assistant_utils.ask_assistant(
|
|
150
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
151
|
+
assistant, prompt, minimal_response=False
|
|
152
|
+
)
|
|
129
153
|
|
|
154
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
130
155
|
similarity_check.check_similarity(response, expected_response)
|
|
@@ -10,7 +10,11 @@ from codemie_test_harness.tests.test_data.git_tools_test_data import (
|
|
|
10
10
|
get_merge_request_changes_test_data,
|
|
11
11
|
update_file_test_data,
|
|
12
12
|
)
|
|
13
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
13
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
14
|
+
get_random_name,
|
|
15
|
+
to_camel_case,
|
|
16
|
+
assert_tool_triggered,
|
|
17
|
+
)
|
|
14
18
|
|
|
15
19
|
|
|
16
20
|
@pytest.mark.assistant
|
|
@@ -40,7 +44,10 @@ def test_assistant_with_list_branch_set_active_branch_tools(
|
|
|
40
44
|
context=code_context(code_datasource),
|
|
41
45
|
settings=git_integration,
|
|
42
46
|
)
|
|
43
|
-
response = assistant_utils.ask_assistant(
|
|
47
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
48
|
+
assistant, prompt, minimal_response=False
|
|
49
|
+
)
|
|
50
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
44
51
|
similarity_check.check_similarity(response, expected_response)
|
|
45
52
|
|
|
46
53
|
|
|
@@ -76,7 +83,10 @@ def test_assistant_with_create_branch_tool(
|
|
|
76
83
|
context=code_context(code_datasource),
|
|
77
84
|
settings=git_integration,
|
|
78
85
|
)
|
|
79
|
-
response = assistant_utils.ask_assistant(
|
|
86
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
87
|
+
assistant, prompt, minimal_response=False
|
|
88
|
+
)
|
|
89
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
80
90
|
|
|
81
91
|
assert_that(
|
|
82
92
|
git_utils.branch_exists(branch_name),
|
|
@@ -126,7 +136,10 @@ def test_assistant_with_create_file_tool(
|
|
|
126
136
|
context=code_context(code_datasource),
|
|
127
137
|
settings=git_integration,
|
|
128
138
|
)
|
|
129
|
-
response = assistant_utils.ask_assistant(
|
|
139
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
140
|
+
assistant, prompt, minimal_response=False
|
|
141
|
+
)
|
|
142
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
130
143
|
|
|
131
144
|
file_content = git_utils.get_file_content(file_name, "main")
|
|
132
145
|
|
|
@@ -172,7 +185,10 @@ def test_assistant_with_create_merge_request_tool(
|
|
|
172
185
|
context=code_context(code_datasource),
|
|
173
186
|
settings=git_integration,
|
|
174
187
|
)
|
|
175
|
-
response = assistant_utils.ask_assistant(
|
|
188
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
189
|
+
assistant, prompt, minimal_response=False
|
|
190
|
+
)
|
|
191
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
176
192
|
mr_id = git_utils.get_merge_request_id_by_title(mr_name)
|
|
177
193
|
|
|
178
194
|
expected = expected_template(source_branch, mr_name, mr_id)
|
|
@@ -231,7 +247,10 @@ def test_assistant_with_delete_file_tool(
|
|
|
231
247
|
context=code_context(code_datasource),
|
|
232
248
|
settings=git_integration,
|
|
233
249
|
)
|
|
234
|
-
response = assistant_utils.ask_assistant(
|
|
250
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
251
|
+
assistant, prompt, minimal_response=False
|
|
252
|
+
)
|
|
253
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
235
254
|
|
|
236
255
|
assert_that(
|
|
237
256
|
git_utils.file_exists(file_name, "main"),
|
|
@@ -282,7 +301,10 @@ def test_assistant_with_get_merge_request_changes_tool(
|
|
|
282
301
|
|
|
283
302
|
create_mr_prompt = create_mr_prompt_template(source_branch, class_name, mr_name)
|
|
284
303
|
|
|
285
|
-
response = assistant_utils.ask_assistant(
|
|
304
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
305
|
+
assistant, create_mr_prompt, minimal_response=False
|
|
306
|
+
)
|
|
307
|
+
assert_tool_triggered(tool_name[:-1], triggered_tools)
|
|
286
308
|
mr_id = git_utils.get_merge_request_id_by_title(mr_name)
|
|
287
309
|
|
|
288
310
|
create_mr_expected = create_mr_expected_template(source_branch, mr_name, mr_id)
|
|
@@ -295,7 +317,10 @@ def test_assistant_with_get_merge_request_changes_tool(
|
|
|
295
317
|
get_changes_prompt = get_mr_changes_prompt_template(mr_id)
|
|
296
318
|
get_changes_expected = get_mr_changes_expected_template(class_name)
|
|
297
319
|
|
|
298
|
-
response = assistant_utils.ask_assistant(
|
|
320
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
321
|
+
assistant, get_changes_prompt, minimal_response=False
|
|
322
|
+
)
|
|
323
|
+
assert_tool_triggered(tool_name[-1], triggered_tools)
|
|
299
324
|
similarity_check.check_similarity(response, get_changes_expected)
|
|
300
325
|
finally:
|
|
301
326
|
if git_utils.branch_exists(source_branch):
|
|
@@ -340,7 +365,10 @@ def test_assistant_with_update_file_tools(
|
|
|
340
365
|
)
|
|
341
366
|
|
|
342
367
|
create_prompt = create_prompt_template(class_name)
|
|
343
|
-
response = assistant_utils.ask_assistant(
|
|
368
|
+
response, create_triggered_tools = assistant_utils.ask_assistant(
|
|
369
|
+
assistant, create_prompt, minimal_response=False
|
|
370
|
+
)
|
|
371
|
+
assert_tool_triggered(tool_name[0], create_triggered_tools)
|
|
344
372
|
|
|
345
373
|
create_expected = create_expected_template(class_name)
|
|
346
374
|
similarity_check.check_similarity(response, create_expected)
|
|
@@ -355,7 +383,10 @@ def test_assistant_with_update_file_tools(
|
|
|
355
383
|
)
|
|
356
384
|
|
|
357
385
|
update_prompt = update_prompt_template(class_name)
|
|
358
|
-
response = assistant_utils.ask_assistant(
|
|
386
|
+
response, update_triggered_tools = assistant_utils.ask_assistant(
|
|
387
|
+
assistant, update_prompt, minimal_response=False
|
|
388
|
+
)
|
|
389
|
+
assert_tool_triggered(tool_name[1], update_triggered_tools)
|
|
359
390
|
|
|
360
391
|
update_expected = update_expected_template(class_name)
|
|
361
392
|
similarity_check.check_similarity(response, update_expected)
|
|
@@ -7,16 +7,19 @@ from hamcrest import assert_that, contains_string
|
|
|
7
7
|
from codemie_sdk.models.integration import CredentialTypes
|
|
8
8
|
from codemie_test_harness.tests import autotest_entity_prefix
|
|
9
9
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
10
|
-
from codemie_test_harness.tests.utils.
|
|
11
|
-
|
|
10
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
11
|
+
get_random_name,
|
|
12
|
+
assert_tool_triggered,
|
|
13
|
+
)
|
|
14
|
+
from codemie_test_harness.tests.enums.tools import CliMcpServer
|
|
12
15
|
from codemie_test_harness.tests.test_data.mcp_server_test_data import (
|
|
13
16
|
cli_mcp_server_test_data,
|
|
14
17
|
CLI_MCP_SERVER,
|
|
15
18
|
)
|
|
16
19
|
|
|
17
|
-
pytestmark = pytest.mark.skipif(
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
+
# pytestmark = pytest.mark.skipif(
|
|
21
|
+
# EnvironmentResolver.is_localhost(), reason="Skipping this test on local environment"
|
|
22
|
+
# )
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
@pytest.mark.assistant
|
|
@@ -31,11 +34,13 @@ def test_cli_mcp_server(
|
|
|
31
34
|
assistant_utils, assistant, similarity_check, command, expected_answer
|
|
32
35
|
):
|
|
33
36
|
assistant = assistant(mcp_server=CLI_MCP_SERVER)
|
|
34
|
-
response = assistant_utils.ask_assistant(
|
|
37
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
35
38
|
assistant,
|
|
36
39
|
f"execute command: '{command}'. In case of error just explain the issue and do not suggest "
|
|
37
40
|
"any workarounds and do not try to run command with other parameters.",
|
|
41
|
+
minimal_response=False,
|
|
38
42
|
)
|
|
43
|
+
assert_tool_triggered(CliMcpServer.RUN_COMMAND, triggered_tools)
|
|
39
44
|
similarity_check.check_similarity(response, expected_answer)
|
|
40
45
|
|
|
41
46
|
|
|
@@ -64,10 +69,12 @@ def test_env_var_in_mcp_server(
|
|
|
64
69
|
assistant = assistant(mcp_server=cli_mcp_server_with_integration)
|
|
65
70
|
|
|
66
71
|
dir_name = f"{autotest_entity_prefix}{get_random_name()}"
|
|
67
|
-
response = assistant_utils.ask_assistant(
|
|
72
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
68
73
|
assistant,
|
|
69
74
|
f"Execute commands sequentially: 'mkdir {dir_name}' then 'ls'. In the end return output of the second command.",
|
|
75
|
+
minimal_response=False,
|
|
70
76
|
)
|
|
77
|
+
assert_tool_triggered(CliMcpServer.RUN_COMMAND, triggered_tools)
|
|
71
78
|
assert_that(
|
|
72
79
|
response,
|
|
73
80
|
contains_string(dir_name),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from codemie_test_harness.tests.utils.
|
|
1
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
2
|
+
from codemie_test_harness.tests.enums.tools import McpServerTime, McpServerFetch
|
|
2
3
|
|
|
3
4
|
import pytest
|
|
4
5
|
|
|
@@ -11,9 +12,9 @@ from codemie_test_harness.tests.test_data.mcp_server_test_data import (
|
|
|
11
12
|
fetch_server_prompt,
|
|
12
13
|
)
|
|
13
14
|
|
|
14
|
-
pytestmark = pytest.mark.skipif(
|
|
15
|
-
|
|
16
|
-
)
|
|
15
|
+
# pytestmark = pytest.mark.skipif(
|
|
16
|
+
# EnvironmentResolver.is_localhost(), reason="Skipping this test on local environment"
|
|
17
|
+
# )
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
@pytest.mark.assistant
|
|
@@ -31,11 +32,13 @@ def test_creation_mcp_server_with_form_configuration(
|
|
|
31
32
|
):
|
|
32
33
|
assistant = assistant(mcp_server=mcp_server)
|
|
33
34
|
|
|
34
|
-
response = assistant_utils.ask_assistant(
|
|
35
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
35
36
|
assistant,
|
|
36
37
|
time_server_prompt,
|
|
38
|
+
minimal_response=False,
|
|
37
39
|
)
|
|
38
40
|
|
|
41
|
+
assert_tool_triggered(McpServerTime.CONVERT_TIME, triggered_tools)
|
|
39
42
|
similarity_check.check_similarity(response, time_expected_response)
|
|
40
43
|
|
|
41
44
|
|
|
@@ -45,6 +48,9 @@ def test_creation_mcp_server_with_form_configuration(
|
|
|
45
48
|
def test_fetch_mcp_server(assistant_utils, assistant, similarity_check):
|
|
46
49
|
assistant = assistant(mcp_server=FETCH_MCP_SERVER)
|
|
47
50
|
|
|
48
|
-
response = assistant_utils.ask_assistant(
|
|
51
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
52
|
+
assistant, fetch_server_prompt, minimal_response=False
|
|
53
|
+
)
|
|
49
54
|
|
|
55
|
+
assert_tool_triggered(McpServerFetch.FETCH, triggered_tools)
|
|
50
56
|
similarity_check.check_similarity(response, fetch_expected_response)
|
codemie_test_harness/tests/assistant/tools/notification/test_assistant_notification_tools.py
CHANGED
|
@@ -6,6 +6,7 @@ from codemie_test_harness.tests.enums.tools import Toolkit, NotificationTool
|
|
|
6
6
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
7
7
|
from codemie_test_harness.tests.enums.environment import Environment
|
|
8
8
|
from codemie_test_harness.tests.utils.env_resolver import get_environment
|
|
9
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
9
10
|
from codemie_test_harness.tests.test_data.notification_tools_test_data import (
|
|
10
11
|
EMAIL_TOOL_PROMPT,
|
|
11
12
|
EMAIL_RESPONSE,
|
|
@@ -40,7 +41,10 @@ def test_assistant_with_email_tool(
|
|
|
40
41
|
Toolkit.NOTIFICATION, NotificationTool.EMAIL, settings=settings
|
|
41
42
|
)
|
|
42
43
|
|
|
43
|
-
response = assistant_utils.ask_assistant(
|
|
44
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
45
|
+
assistant, EMAIL_TOOL_PROMPT, minimal_response=False
|
|
46
|
+
)
|
|
47
|
+
assert_tool_triggered(NotificationTool.EMAIL, triggered_tools)
|
|
44
48
|
similarity_check.check_similarity(response, EMAIL_RESPONSE)
|
|
45
49
|
|
|
46
50
|
message_data = gmail_message_operator.get_messages_list()
|
|
@@ -78,5 +82,8 @@ def test_assistant_with_telegram_tool(
|
|
|
78
82
|
Toolkit.NOTIFICATION, NotificationTool.TELEGRAM, settings=settings
|
|
79
83
|
)
|
|
80
84
|
|
|
81
|
-
response = assistant_utils.ask_assistant(
|
|
85
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
86
|
+
assistant, TELEGRAM_TOOL_PROMPT, minimal_response=False
|
|
87
|
+
)
|
|
88
|
+
assert_tool_triggered(NotificationTool.TELEGRAM, triggered_tools)
|
|
82
89
|
similarity_check.check_similarity(response, TELEGRAM_RESPONSE)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from codemie_test_harness.tests.utils.env_resolver import EnvironmentResolver
|
|
2
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
2
3
|
|
|
3
4
|
import pytest
|
|
4
5
|
|
|
@@ -34,6 +35,9 @@ def test_create_assistant_with_open_api_tool(
|
|
|
34
35
|
Toolkit.OPEN_API, tool_name, settings=open_api_integration
|
|
35
36
|
)
|
|
36
37
|
|
|
37
|
-
response = assistant_utils.ask_assistant(
|
|
38
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
39
|
+
assistant_instance, prompt, minimal_response=False
|
|
40
|
+
)
|
|
38
41
|
|
|
42
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
39
43
|
similarity_check.check_similarity(response, expected_response)
|