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
|
@@ -4,8 +4,13 @@ import pytest
|
|
|
4
4
|
from hamcrest import assert_that, equal_to
|
|
5
5
|
from requests import HTTPError
|
|
6
6
|
|
|
7
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
7
8
|
from codemie_test_harness.tests.test_data.index_test_data import index_test_data
|
|
8
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
9
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
10
|
+
get_random_name,
|
|
11
|
+
assert_response,
|
|
12
|
+
assert_tool_triggered,
|
|
13
|
+
)
|
|
9
14
|
|
|
10
15
|
|
|
11
16
|
@pytest.mark.datasource
|
|
@@ -35,16 +40,24 @@ def test_create_index_application_with_embedding_model(
|
|
|
35
40
|
setting_id=git_integration.id, embeddings_model=embedding_model
|
|
36
41
|
)
|
|
37
42
|
|
|
38
|
-
assistant = assistant(
|
|
43
|
+
assistant = assistant(
|
|
44
|
+
context=code_context(datasource), system_prompt="Run tools on each user prompt"
|
|
45
|
+
)
|
|
39
46
|
|
|
40
|
-
answer = assistant_utils.ask_assistant(
|
|
47
|
+
answer, triggered_tools = assistant_utils.ask_assistant(
|
|
48
|
+
assistant, question, minimal_response=False
|
|
49
|
+
)
|
|
50
|
+
assert_tool_triggered(Default.GET_REPOSITORY_FILE_TREE, triggered_tools)
|
|
41
51
|
similarity_check.check_similarity(answer, expected_answer)
|
|
42
52
|
|
|
43
53
|
datasource_utils.update_code_datasource(
|
|
44
54
|
datasource.id, full_reindex=True, skip_reindex=False
|
|
45
55
|
)
|
|
46
56
|
|
|
47
|
-
answer = assistant_utils.ask_assistant(
|
|
57
|
+
answer, triggered_tools = assistant_utils.ask_assistant(
|
|
58
|
+
assistant, question, minimal_response=False
|
|
59
|
+
)
|
|
60
|
+
assert_tool_triggered(Default.GET_REPOSITORY_FILE_TREE, triggered_tools)
|
|
48
61
|
similarity_check.check_similarity(answer, expected_answer)
|
|
49
62
|
|
|
50
63
|
|
|
@@ -13,7 +13,12 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
|
13
13
|
RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
|
|
14
14
|
)
|
|
15
15
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
16
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
16
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
17
|
+
get_random_name,
|
|
18
|
+
assert_response,
|
|
19
|
+
assert_tool_triggered,
|
|
20
|
+
)
|
|
21
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
17
22
|
|
|
18
23
|
|
|
19
24
|
@pytest.fixture(scope="function")
|
|
@@ -61,16 +66,24 @@ def test_create_datasource_with_confluence_and_confluence_cloud_integration(
|
|
|
61
66
|
expected_response,
|
|
62
67
|
):
|
|
63
68
|
datasource = request.getfixturevalue(datasource_fixture)
|
|
64
|
-
assistant = assistant(
|
|
69
|
+
assistant = assistant(
|
|
70
|
+
context=kb_context(datasource), system_prompt="Run tools on each user prompt"
|
|
71
|
+
)
|
|
65
72
|
|
|
66
|
-
response = assistant_utils.ask_assistant(
|
|
73
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
74
|
+
assistant, prompt, minimal_response=False
|
|
75
|
+
)
|
|
76
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
67
77
|
similarity_check.check_similarity(response, expected_response)
|
|
68
78
|
|
|
69
79
|
datasource_utils.update_confluence_datasource(
|
|
70
80
|
datasource.id, full_reindex=True, skip_reindex=False
|
|
71
81
|
)
|
|
72
82
|
|
|
73
|
-
response = assistant_utils.ask_assistant(
|
|
83
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
84
|
+
assistant, prompt, minimal_response=False
|
|
85
|
+
)
|
|
86
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
74
87
|
similarity_check.check_similarity(response, expected_response)
|
|
75
88
|
|
|
76
89
|
|
|
@@ -6,12 +6,17 @@ from hamcrest import (
|
|
|
6
6
|
)
|
|
7
7
|
from requests import HTTPError
|
|
8
8
|
|
|
9
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
9
10
|
from codemie_test_harness.tests.test_data.file_test_data import (
|
|
10
11
|
file_test_data,
|
|
11
12
|
large_files_test_data,
|
|
12
13
|
RESPONSE_FOR_TWO_FILES_INDEXED,
|
|
13
14
|
)
|
|
14
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
15
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
16
|
+
get_random_name,
|
|
17
|
+
assert_response,
|
|
18
|
+
assert_tool_triggered,
|
|
19
|
+
)
|
|
15
20
|
from codemie_test_harness.tests.test_data.index_test_data import index_test_data
|
|
16
21
|
from codemie_test_harness.tests.utils.client_factory import get_client
|
|
17
22
|
from codemie_test_harness.tests.utils.constants import FILES_PATH
|
|
@@ -82,7 +87,10 @@ def test_create_assistant_with_file_datasource(
|
|
|
82
87
|
test_assistant = assistant(context=kb_context(datasource))
|
|
83
88
|
|
|
84
89
|
prompt = "Show KB context. Return all information available in the context. Query may be 'Show content of the KB'"
|
|
85
|
-
response = assistant_utils.ask_assistant(
|
|
90
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
91
|
+
test_assistant, prompt, minimal_response=False
|
|
92
|
+
)
|
|
93
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
86
94
|
|
|
87
95
|
similarity_check.check_similarity(
|
|
88
96
|
response, expected_response, assistant_name=test_assistant.name
|
|
@@ -168,8 +176,11 @@ def test_create_file_datasource_with_two_files(
|
|
|
168
176
|
|
|
169
177
|
test_assistant = assistant(context=kb_context(datasource))
|
|
170
178
|
|
|
171
|
-
response = assistant_utils.ask_assistant(
|
|
172
|
-
test_assistant,
|
|
179
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
180
|
+
test_assistant,
|
|
181
|
+
"What types of data do we have available?",
|
|
182
|
+
minimal_response=False,
|
|
173
183
|
)
|
|
184
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
174
185
|
|
|
175
186
|
similarity_check.check_similarity(response, RESPONSE_FOR_TWO_FILES_INDEXED)
|
|
@@ -9,7 +9,12 @@ from codemie_test_harness.tests.test_data.google_datasource_test_data import (
|
|
|
9
9
|
RESPONSE_FOR_GOOGLE_DOC,
|
|
10
10
|
USER_PROMPT,
|
|
11
11
|
)
|
|
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_response,
|
|
15
|
+
assert_tool_triggered,
|
|
16
|
+
)
|
|
17
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
@pytest.mark.datasource
|
|
@@ -24,16 +29,25 @@ def test_create_datasource_with_google_integration(
|
|
|
24
29
|
kb_context,
|
|
25
30
|
google_doc_datasource,
|
|
26
31
|
):
|
|
27
|
-
assistant = assistant(
|
|
32
|
+
assistant = assistant(
|
|
33
|
+
context=kb_context(google_doc_datasource),
|
|
34
|
+
system_prompt="Run tools on each user prompt",
|
|
35
|
+
)
|
|
28
36
|
|
|
29
|
-
response_from_llm = assistant_utils.ask_assistant(
|
|
37
|
+
response_from_llm, triggered_tools = assistant_utils.ask_assistant(
|
|
38
|
+
assistant, USER_PROMPT, minimal_response=False
|
|
39
|
+
)
|
|
40
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
30
41
|
similarity_check.check_similarity(response_from_llm, RESPONSE_FOR_GOOGLE_DOC)
|
|
31
42
|
|
|
32
43
|
datasource_utils.update_google_doc_datasource(
|
|
33
44
|
google_doc_datasource.id, full_reindex=True, skip_reindex=False
|
|
34
45
|
)
|
|
35
46
|
|
|
36
|
-
response_from_llm = assistant_utils.ask_assistant(
|
|
47
|
+
response_from_llm, triggered_tools = assistant_utils.ask_assistant(
|
|
48
|
+
assistant, USER_PROMPT, minimal_response=False
|
|
49
|
+
)
|
|
50
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
37
51
|
similarity_check.check_similarity(response_from_llm, RESPONSE_FOR_GOOGLE_DOC)
|
|
38
52
|
|
|
39
53
|
|
|
@@ -12,7 +12,12 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
|
12
12
|
RESPONSE_FOR_JIRA_CLOUD_TOOL,
|
|
13
13
|
)
|
|
14
14
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
15
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
15
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
16
|
+
get_random_name,
|
|
17
|
+
assert_response,
|
|
18
|
+
assert_tool_triggered,
|
|
19
|
+
)
|
|
20
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
@pytest.fixture(scope="function")
|
|
@@ -59,17 +64,25 @@ def test_create_datasource_with_jira_and_jira_cloud_integration(
|
|
|
59
64
|
expected_response,
|
|
60
65
|
):
|
|
61
66
|
datasource = request.getfixturevalue(datasource_fixture)
|
|
62
|
-
assistant = assistant(
|
|
67
|
+
assistant = assistant(
|
|
68
|
+
context=kb_context(datasource), system_prompt="Run tools on each user prompt"
|
|
69
|
+
)
|
|
63
70
|
|
|
64
|
-
response = assistant_utils.ask_assistant(
|
|
65
|
-
|
|
71
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
72
|
+
assistant, prompt, minimal_response=False
|
|
73
|
+
)
|
|
74
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
75
|
+
similarity_check.check_similarity(response, expected_response)
|
|
66
76
|
|
|
67
77
|
datasource_utils.update_jira_datasource(
|
|
68
78
|
datasource.id, full_reindex=True, skip_reindex=False
|
|
69
79
|
)
|
|
70
80
|
|
|
71
|
-
response = assistant_utils.ask_assistant(
|
|
72
|
-
|
|
81
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
82
|
+
assistant, prompt, minimal_response=False
|
|
83
|
+
)
|
|
84
|
+
assert_tool_triggered(Default.SEARCH_KB, triggered_tools)
|
|
85
|
+
similarity_check.check_similarity(response, expected_response)
|
|
73
86
|
|
|
74
87
|
|
|
75
88
|
@pytest.mark.datasource
|
codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool.py
CHANGED
|
@@ -13,6 +13,7 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
|
13
13
|
)
|
|
14
14
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
15
15
|
from codemie_test_harness.tests.utils.constants import test_project_name
|
|
16
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
@pytest.mark.integration
|
|
@@ -71,8 +72,11 @@ def test_assistant_should_use_user_integration_by_default(
|
|
|
71
72
|
project_name=test_project_name,
|
|
72
73
|
)
|
|
73
74
|
|
|
74
|
-
response = assistant_utils.ask_assistant(
|
|
75
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
76
|
+
jira_assistant, JIRA_TOOL_PROMPT, minimal_response=False
|
|
77
|
+
)
|
|
75
78
|
|
|
79
|
+
assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
|
|
76
80
|
similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
|
|
77
81
|
|
|
78
82
|
|
|
@@ -115,8 +119,11 @@ def test_assistant_with_global_and_project_integration(
|
|
|
115
119
|
project_name=test_project_name,
|
|
116
120
|
)
|
|
117
121
|
|
|
118
|
-
response = assistant_utils.ask_assistant(
|
|
122
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
123
|
+
jira_assistant, JIRA_TOOL_PROMPT, minimal_response=False
|
|
124
|
+
)
|
|
119
125
|
|
|
126
|
+
assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
|
|
120
127
|
similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
|
|
121
128
|
|
|
122
129
|
|
|
@@ -150,8 +157,11 @@ def test_assistant_with_project_integration_only(
|
|
|
150
157
|
project_name=test_project_name,
|
|
151
158
|
)
|
|
152
159
|
|
|
153
|
-
response = assistant_utils.ask_assistant(
|
|
160
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
161
|
+
jira_assistant, JIRA_TOOL_PROMPT, minimal_response=False
|
|
162
|
+
)
|
|
154
163
|
|
|
164
|
+
assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
|
|
155
165
|
similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
|
|
156
166
|
|
|
157
167
|
|
|
@@ -190,8 +200,11 @@ def test_assistant_with_global_valid_and_user_invalid_integration(
|
|
|
190
200
|
project_name=test_project_name,
|
|
191
201
|
)
|
|
192
202
|
|
|
193
|
-
response = assistant_utils.ask_assistant(
|
|
203
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
204
|
+
jira_assistant, JIRA_TOOL_PROMPT, minimal_response=False
|
|
205
|
+
)
|
|
194
206
|
|
|
207
|
+
assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
|
|
195
208
|
similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
|
|
196
209
|
|
|
197
210
|
|
|
@@ -230,6 +243,9 @@ def test_assistant_with_project_valid_and_user_invalid_integration(
|
|
|
230
243
|
project_name=test_project_name,
|
|
231
244
|
)
|
|
232
245
|
|
|
233
|
-
response = assistant_utils.ask_assistant(
|
|
246
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
247
|
+
jira_assistant, JIRA_TOOL_PROMPT, minimal_response=False
|
|
248
|
+
)
|
|
234
249
|
|
|
250
|
+
assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
|
|
235
251
|
similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
|
codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool_kit.py
CHANGED
|
@@ -12,6 +12,7 @@ from codemie_test_harness.tests.test_data.ado_wiki_tools_test_data import (
|
|
|
12
12
|
)
|
|
13
13
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
14
14
|
from codemie_test_harness.tests.utils.constants import test_project_name
|
|
15
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
15
16
|
|
|
16
17
|
ado_wiki_prompt = ado_wiki_get_test_data[1][2]
|
|
17
18
|
ado_wiki_answer = ado_wiki_get_test_data[1][3]
|
|
@@ -75,8 +76,11 @@ def test_assistant_should_use_user_integration_by_default(
|
|
|
75
76
|
project_name=test_project_name,
|
|
76
77
|
)
|
|
77
78
|
|
|
78
|
-
response = assistant_utils.ask_assistant(
|
|
79
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
80
|
+
ado_assistant, ado_wiki_prompt, minimal_response=False
|
|
81
|
+
)
|
|
79
82
|
|
|
83
|
+
assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
|
|
80
84
|
similarity_check.check_similarity(response, ado_wiki_answer)
|
|
81
85
|
|
|
82
86
|
|
|
@@ -120,8 +124,11 @@ def test_assistant_with_global_and_project_integration(
|
|
|
120
124
|
project_name=test_project_name,
|
|
121
125
|
)
|
|
122
126
|
|
|
123
|
-
response = assistant_utils.ask_assistant(
|
|
127
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
128
|
+
ado_assistant, ado_wiki_prompt, minimal_response=False
|
|
129
|
+
)
|
|
124
130
|
|
|
131
|
+
assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
|
|
125
132
|
similarity_check.check_similarity(response, ado_wiki_answer)
|
|
126
133
|
|
|
127
134
|
|
|
@@ -157,8 +164,11 @@ def test_assistant_with_project_integration_only(
|
|
|
157
164
|
project_name=test_project_name,
|
|
158
165
|
)
|
|
159
166
|
|
|
160
|
-
response = assistant_utils.ask_assistant(
|
|
167
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
168
|
+
ado_assistant, ado_wiki_prompt, minimal_response=False
|
|
169
|
+
)
|
|
161
170
|
|
|
171
|
+
assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
|
|
162
172
|
similarity_check.check_similarity(response, ado_wiki_answer)
|
|
163
173
|
|
|
164
174
|
|
|
@@ -199,8 +209,11 @@ def test_assistant_with_global_valid_and_user_invalid_integration(
|
|
|
199
209
|
project_name=test_project_name,
|
|
200
210
|
)
|
|
201
211
|
|
|
202
|
-
response = assistant_utils.ask_assistant(
|
|
212
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
213
|
+
ado_assistant, ado_wiki_prompt, minimal_response=False
|
|
214
|
+
)
|
|
203
215
|
|
|
216
|
+
assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
|
|
204
217
|
similarity_check.check_similarity(response, ado_wiki_answer)
|
|
205
218
|
|
|
206
219
|
|
|
@@ -241,6 +254,9 @@ def test_assistant_with_project_valid_and_user_invalid_integration(
|
|
|
241
254
|
project_name=test_project_name,
|
|
242
255
|
)
|
|
243
256
|
|
|
244
|
-
response = assistant_utils.ask_assistant(
|
|
257
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
258
|
+
ado_assistant, ado_wiki_prompt, minimal_response=False
|
|
259
|
+
)
|
|
245
260
|
|
|
261
|
+
assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
|
|
246
262
|
similarity_check.check_similarity(response, ado_wiki_answer)
|
|
@@ -12,6 +12,7 @@ from codemie_test_harness.tests.test_data.git_tools_test_data import (
|
|
|
12
12
|
)
|
|
13
13
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
14
14
|
from codemie_test_harness.tests.utils.constants import test_project_name
|
|
15
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
git_tool_prompt = list_branches_set_active_branch_test_data[0][2]
|
|
@@ -86,8 +87,11 @@ def test_assistant_should_use_user_integration_by_default(
|
|
|
86
87
|
project_name=test_project_name,
|
|
87
88
|
)
|
|
88
89
|
|
|
89
|
-
response = assistant_utils.ask_assistant(
|
|
90
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
91
|
+
git_assistant, git_tool_prompt, minimal_response=False
|
|
92
|
+
)
|
|
90
93
|
|
|
94
|
+
assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
|
|
91
95
|
similarity_check.check_similarity(response, git_tool_answer)
|
|
92
96
|
|
|
93
97
|
|
|
@@ -145,8 +149,11 @@ def test_assistant_with_global_and_project_integration(
|
|
|
145
149
|
project_name=test_project_name,
|
|
146
150
|
)
|
|
147
151
|
|
|
148
|
-
response = assistant_utils.ask_assistant(
|
|
152
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
153
|
+
git_assistant, git_tool_prompt, minimal_response=False
|
|
154
|
+
)
|
|
149
155
|
|
|
156
|
+
assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
|
|
150
157
|
similarity_check.check_similarity(response, git_tool_answer)
|
|
151
158
|
|
|
152
159
|
|
|
@@ -191,8 +198,11 @@ def test_assistant_with_project_integration_only(
|
|
|
191
198
|
project_name=test_project_name,
|
|
192
199
|
)
|
|
193
200
|
|
|
194
|
-
response = assistant_utils.ask_assistant(
|
|
201
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
202
|
+
git_assistant, git_tool_prompt, minimal_response=False
|
|
203
|
+
)
|
|
195
204
|
|
|
205
|
+
assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
|
|
196
206
|
similarity_check.check_similarity(response, git_tool_answer)
|
|
197
207
|
|
|
198
208
|
|
|
@@ -249,8 +259,11 @@ def test_assistant_with_global_valid_and_user_invalid_integration(
|
|
|
249
259
|
project_name=test_project_name,
|
|
250
260
|
)
|
|
251
261
|
|
|
252
|
-
response = assistant_utils.ask_assistant(
|
|
262
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
263
|
+
git_assistant, git_tool_prompt, minimal_response=False
|
|
264
|
+
)
|
|
253
265
|
|
|
266
|
+
assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
|
|
254
267
|
similarity_check.check_similarity(response, git_tool_answer)
|
|
255
268
|
|
|
256
269
|
|
|
@@ -307,6 +320,9 @@ def test_assistant_with_project_valid_and_user_invalid_integration(
|
|
|
307
320
|
project_name=test_project_name,
|
|
308
321
|
)
|
|
309
322
|
|
|
310
|
-
response = assistant_utils.ask_assistant(
|
|
323
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
324
|
+
git_assistant, git_tool_prompt, minimal_response=False
|
|
325
|
+
)
|
|
311
326
|
|
|
327
|
+
assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
|
|
312
328
|
similarity_check.check_similarity(response, git_tool_answer)
|
|
@@ -24,7 +24,11 @@ from codemie_test_harness.tests.test_data.file_test_data import (
|
|
|
24
24
|
RESPONSE_FOR_TWO_FILES_UPLOADED,
|
|
25
25
|
)
|
|
26
26
|
from codemie_test_harness.tests.test_data.output_schema_test_data import output_schema
|
|
27
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
27
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
28
|
+
get_random_name,
|
|
29
|
+
assert_tool_triggered,
|
|
30
|
+
)
|
|
31
|
+
from codemie_test_harness.tests.enums.tools import Default
|
|
28
32
|
from codemie_test_harness.tests.utils.constants import FILES_PATH
|
|
29
33
|
from codemie_test_harness.tests.utils.file_utils import save_file
|
|
30
34
|
|
|
@@ -224,7 +228,7 @@ def test_export_assistant(assistant_utils):
|
|
|
224
228
|
@pytest.mark.smoke
|
|
225
229
|
@pytest.mark.testcase("EPMCDME-4001, EPMCDME-4002, EPMCDME-2527")
|
|
226
230
|
@pytest.mark.parametrize(
|
|
227
|
-
"file_name,expected_response",
|
|
231
|
+
"file_name,expected_response,expected_tool",
|
|
228
232
|
file_test_data,
|
|
229
233
|
ids=[f"{row[0]}" for row in file_test_data],
|
|
230
234
|
)
|
|
@@ -234,6 +238,7 @@ def test_create_assistant_and_prompt_with_file(
|
|
|
234
238
|
similarity_check,
|
|
235
239
|
file_name,
|
|
236
240
|
expected_response,
|
|
241
|
+
expected_tool,
|
|
237
242
|
):
|
|
238
243
|
prompt = (
|
|
239
244
|
f"What is the content/text of the {file_name}. Show information from ALL pages. "
|
|
@@ -249,14 +254,20 @@ def test_create_assistant_and_prompt_with_file(
|
|
|
249
254
|
|
|
250
255
|
conversation_id = str(uuid.uuid4())
|
|
251
256
|
|
|
252
|
-
response = assistant_utils.ask_assistant(
|
|
253
|
-
assistant,
|
|
257
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
258
|
+
assistant,
|
|
259
|
+
prompt,
|
|
260
|
+
file_urls=[file_url],
|
|
261
|
+
conversation_id=conversation_id,
|
|
262
|
+
minimal_response=False,
|
|
254
263
|
)
|
|
264
|
+
assert_tool_triggered(expected_tool, triggered_tools)
|
|
255
265
|
similarity_check.check_similarity(response, expected_response)
|
|
256
266
|
|
|
257
|
-
response = assistant_utils.ask_assistant(
|
|
258
|
-
assistant, prompt, conversation_id=conversation_id
|
|
267
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
268
|
+
assistant, prompt, conversation_id=conversation_id, minimal_response=False
|
|
259
269
|
)
|
|
270
|
+
assert_tool_triggered(expected_tool, triggered_tools)
|
|
260
271
|
similarity_check.check_similarity(response, expected_response)
|
|
261
272
|
|
|
262
273
|
|
|
@@ -382,17 +393,22 @@ def test_create_assistant_and_prompt_with_multiple_files(
|
|
|
382
393
|
|
|
383
394
|
conversation_id = str(uuid.uuid4())
|
|
384
395
|
|
|
385
|
-
response = assistant_utils.ask_assistant(
|
|
396
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
386
397
|
assistant,
|
|
387
398
|
prompt,
|
|
388
399
|
file_urls=[docx_file_url, ini_file_url],
|
|
389
400
|
conversation_id=conversation_id,
|
|
401
|
+
minimal_response=False,
|
|
390
402
|
)
|
|
403
|
+
|
|
404
|
+
assert_tool_triggered((Default.DOCX_TOOL, Default.FILE_ANALYSIS), triggered_tools)
|
|
391
405
|
similarity_check.check_similarity(response, RESPONSE_FOR_TWO_FILES_UPLOADED)
|
|
392
406
|
|
|
393
|
-
response = assistant_utils.ask_assistant(
|
|
394
|
-
assistant, prompt, conversation_id=conversation_id
|
|
407
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
408
|
+
assistant, prompt, conversation_id=conversation_id, minimal_response=False
|
|
395
409
|
)
|
|
410
|
+
|
|
411
|
+
assert_tool_triggered((Default.DOCX_TOOL, Default.FILE_ANALYSIS), triggered_tools)
|
|
396
412
|
similarity_check.check_similarity(response, RESPONSE_FOR_TWO_FILES_UPLOADED)
|
|
397
413
|
|
|
398
414
|
|
|
@@ -428,10 +444,11 @@ def test_excel_tool_extended_functionality(
|
|
|
428
444
|
file_url = uploaded_file.get("file_url")
|
|
429
445
|
|
|
430
446
|
# Send the prompt with the uploaded file
|
|
431
|
-
response = assistant_utils.ask_assistant(
|
|
432
|
-
assistant_instance, prompt, file_urls=[file_url]
|
|
447
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
448
|
+
assistant_instance, prompt, file_urls=[file_url], minimal_response=False
|
|
433
449
|
)
|
|
434
450
|
|
|
451
|
+
assert_tool_triggered(Default.EXCEL_TOOL, triggered_tools)
|
|
435
452
|
similarity_check.check_similarity(response, expected_response)
|
|
436
453
|
|
|
437
454
|
|
|
@@ -467,8 +484,9 @@ def test_docx_tool_extended_functionality(
|
|
|
467
484
|
file_url = uploaded_file.get("file_url")
|
|
468
485
|
|
|
469
486
|
# Send the prompt with the uploaded file
|
|
470
|
-
response = assistant_utils.ask_assistant(
|
|
471
|
-
assistant_instance, prompt, file_urls=[file_url]
|
|
487
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
488
|
+
assistant_instance, prompt, file_urls=[file_url], minimal_response=False
|
|
472
489
|
)
|
|
473
490
|
|
|
491
|
+
assert_tool_triggered(Default.DOCX_TOOL, triggered_tools)
|
|
474
492
|
similarity_check.check_similarity(response, expected_response)
|
|
@@ -5,6 +5,7 @@ from codemie_test_harness.tests.test_data.keycloak_tool_test_data import (
|
|
|
5
5
|
KEYCLOAK_TOOL_PROMPT,
|
|
6
6
|
KEYCLOAK_TOOL_RESPONSE,
|
|
7
7
|
)
|
|
8
|
+
from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
@pytest.mark.assistant
|
|
@@ -22,6 +23,10 @@ def test_assistant_with_keycloak_tool(
|
|
|
22
23
|
settings=keycloak_integration,
|
|
23
24
|
)
|
|
24
25
|
|
|
25
|
-
response = assistant_utils.ask_assistant(
|
|
26
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
27
|
+
keycloak_assistant, KEYCLOAK_TOOL_PROMPT, minimal_response=False
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
assert_tool_triggered(AccessManagementTool.KEYCLOAK, triggered_tools)
|
|
26
31
|
|
|
27
32
|
similarity_check.check_similarity(response, KEYCLOAK_TOOL_RESPONSE)
|
|
@@ -11,7 +11,10 @@ from codemie_test_harness.tests.test_data.ado_test_plan_tools_test_data import (
|
|
|
11
11
|
ADO_TEST_PLAN_DELETE_PLAN,
|
|
12
12
|
)
|
|
13
13
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
14
|
-
from codemie_test_harness.tests.utils.base_utils import
|
|
14
|
+
from codemie_test_harness.tests.utils.base_utils import (
|
|
15
|
+
get_random_name,
|
|
16
|
+
assert_tool_triggered,
|
|
17
|
+
)
|
|
15
18
|
from codemie_test_harness.tests.utils.constants import ID_PATTERN
|
|
16
19
|
from codemie_test_harness.tests.utils.json_utils import extract_id_from_ado_response
|
|
17
20
|
|
|
@@ -44,7 +47,11 @@ def test_assistant_with_ado_test_plan_get_tools(
|
|
|
44
47
|
settings=settings,
|
|
45
48
|
)
|
|
46
49
|
|
|
47
|
-
response = assistant_utils.ask_assistant(
|
|
50
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
51
|
+
assistant, prompt, minimal_response=False
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
48
55
|
similarity_check.check_similarity(response, expected_response)
|
|
49
56
|
|
|
50
57
|
|
|
@@ -78,13 +85,18 @@ def test_assistant_with_ado_test_plan_tools(
|
|
|
78
85
|
create_prompt = ADO_TEST_PLAN_CREATE_TEST_PLAN["prompt_to_assistant"].format(
|
|
79
86
|
test_plan_title
|
|
80
87
|
)
|
|
81
|
-
create_response = assistant_utils.ask_assistant(
|
|
88
|
+
create_response, create_triggered_tools = assistant_utils.ask_assistant(
|
|
89
|
+
assistant, create_prompt, minimal_response=False
|
|
90
|
+
)
|
|
82
91
|
|
|
83
92
|
# Extract the test plan ID from the response
|
|
84
93
|
test_plan_id = extract_id_from_ado_response(create_response, ID_PATTERN)
|
|
85
94
|
create_expected = ADO_TEST_PLAN_CREATE_TEST_PLAN["expected_llm_answer"].format(
|
|
86
95
|
test_plan_title, test_plan_id
|
|
87
96
|
)
|
|
97
|
+
assert_tool_triggered(
|
|
98
|
+
AzureDevOpsTestPlanTool.CREATE_TEST_PLAN, create_triggered_tools
|
|
99
|
+
)
|
|
88
100
|
similarity_check.check_similarity(create_response, create_expected)
|
|
89
101
|
|
|
90
102
|
# Calculate root suite ID (based on the Java implementation)
|
|
@@ -94,8 +106,8 @@ def test_assistant_with_ado_test_plan_tools(
|
|
|
94
106
|
create_suite_prompt = ADO_TEST_PLAN_CREATE_SUITE["prompt_to_assistant"].format(
|
|
95
107
|
root_suite_id, test_plan_id
|
|
96
108
|
)
|
|
97
|
-
create_suite_response = assistant_utils.ask_assistant(
|
|
98
|
-
assistant, create_suite_prompt
|
|
109
|
+
create_suite_response, create_suite_triggered_tools = assistant_utils.ask_assistant(
|
|
110
|
+
assistant, create_suite_prompt, minimal_response=False
|
|
99
111
|
)
|
|
100
112
|
|
|
101
113
|
# Extract the test suite ID from the response
|
|
@@ -103,36 +115,52 @@ def test_assistant_with_ado_test_plan_tools(
|
|
|
103
115
|
create_suite_expected = ADO_TEST_PLAN_CREATE_SUITE["expected_llm_answer"].format(
|
|
104
116
|
test_suite_id
|
|
105
117
|
)
|
|
118
|
+
assert_tool_triggered(
|
|
119
|
+
AzureDevOpsTestPlanTool.CREATE_TEST_SUITE, create_suite_triggered_tools
|
|
120
|
+
)
|
|
106
121
|
similarity_check.check_similarity(create_suite_response, create_suite_expected)
|
|
107
122
|
|
|
108
123
|
# 3. Add test case to the suite
|
|
109
124
|
add_case_prompt = ADO_TEST_PLAN_ADD_TEST_CASE["prompt_to_assistant"].format(
|
|
110
125
|
test_suite_id, test_plan_id
|
|
111
126
|
)
|
|
112
|
-
add_case_response = assistant_utils.ask_assistant(
|
|
127
|
+
add_case_response, add_case_triggered_tools = assistant_utils.ask_assistant(
|
|
128
|
+
assistant, add_case_prompt, minimal_response=False
|
|
129
|
+
)
|
|
113
130
|
add_case_expected = ADO_TEST_PLAN_ADD_TEST_CASE["expected_llm_answer"].format(
|
|
114
131
|
test_suite_id, test_plan_id
|
|
115
132
|
)
|
|
133
|
+
assert_tool_triggered(
|
|
134
|
+
AzureDevOpsTestPlanTool.ADD_TEST_CASE, add_case_triggered_tools
|
|
135
|
+
)
|
|
116
136
|
similarity_check.check_similarity(add_case_response, add_case_expected)
|
|
117
137
|
|
|
118
138
|
# 4. Delete test suite
|
|
119
139
|
delete_suite_prompt = ADO_TEST_PLAN_DELETE_SUITE["prompt_to_assistant"].format(
|
|
120
140
|
test_suite_id, test_plan_id
|
|
121
141
|
)
|
|
122
|
-
delete_suite_response = assistant_utils.ask_assistant(
|
|
123
|
-
assistant, delete_suite_prompt
|
|
142
|
+
delete_suite_response, delete_suite_triggered_tools = assistant_utils.ask_assistant(
|
|
143
|
+
assistant, delete_suite_prompt, minimal_response=False
|
|
124
144
|
)
|
|
125
145
|
delete_suite_expected = ADO_TEST_PLAN_DELETE_SUITE["expected_llm_answer"].format(
|
|
126
146
|
test_suite_id, test_plan_id
|
|
127
147
|
)
|
|
148
|
+
assert_tool_triggered(
|
|
149
|
+
AzureDevOpsTestPlanTool.DELETE_TEST_SUITE, delete_suite_triggered_tools
|
|
150
|
+
)
|
|
128
151
|
similarity_check.check_similarity(delete_suite_response, delete_suite_expected)
|
|
129
152
|
|
|
130
153
|
# 5. Delete test plan
|
|
131
154
|
delete_plan_prompt = ADO_TEST_PLAN_DELETE_PLAN["prompt_to_assistant"].format(
|
|
132
155
|
test_plan_id
|
|
133
156
|
)
|
|
134
|
-
delete_plan_response = assistant_utils.ask_assistant(
|
|
157
|
+
delete_plan_response, delete_plan_triggered_tools = assistant_utils.ask_assistant(
|
|
158
|
+
assistant, delete_plan_prompt, minimal_response=False
|
|
159
|
+
)
|
|
135
160
|
delete_plan_expected = ADO_TEST_PLAN_DELETE_PLAN["expected_llm_answer"].format(
|
|
136
161
|
test_plan_id
|
|
137
162
|
)
|
|
163
|
+
assert_tool_triggered(
|
|
164
|
+
AzureDevOpsTestPlanTool.DELETE_TEST_PLAN, delete_plan_triggered_tools
|
|
165
|
+
)
|
|
138
166
|
similarity_check.check_similarity(delete_plan_response, delete_plan_expected)
|