codemie-test-harness 0.1.184__py3-none-any.whl → 0.1.198__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.

Files changed (81) hide show
  1. codemie_test_harness/cli/cli.py +42 -6
  2. codemie_test_harness/cli/commands/config_cmd.py +1 -1
  3. codemie_test_harness/cli/commands/run_cmd.py +24 -1
  4. codemie_test_harness/cli/constants.py +1 -0
  5. codemie_test_harness/cli/runner.py +17 -3
  6. codemie_test_harness/cli/utils.py +12 -2
  7. codemie_test_harness/pytest.ini +3 -0
  8. codemie_test_harness/tests/assistant/test_assistants.py +17 -1
  9. codemie_test_harness/tests/assistant/tools/datamanagement/test_assistant_with_data_management_tools.py +47 -6
  10. codemie_test_harness/tests/assistant/tools/mcp/test_cli_mcp_server.py +0 -4
  11. codemie_test_harness/tests/assistant/tools/mcp/test_mcp_servers.py +0 -4
  12. codemie_test_harness/tests/conftest.py +19 -3
  13. codemie_test_harness/tests/enums/environment.py +3 -3
  14. codemie_test_harness/tests/enums/integrations.py +1 -0
  15. codemie_test_harness/tests/enums/model_types.py +1 -0
  16. codemie_test_harness/tests/integrations/project/test_default_integrations.py +41 -15
  17. codemie_test_harness/tests/integrations/project/test_project_integrations.py +42 -0
  18. codemie_test_harness/tests/integrations/user/test_default_integrations.py +41 -15
  19. codemie_test_harness/tests/llm/assistants/test_llm.py +45 -2
  20. codemie_test_harness/tests/test_data/assistant_test_data.py +171 -171
  21. codemie_test_harness/tests/test_data/codebase_tools_test_data.py +2 -0
  22. codemie_test_harness/tests/test_data/data_management_tools_test_data.py +18 -0
  23. codemie_test_harness/tests/test_data/direct_tools/data_management_tools_test_data.py +18 -1
  24. codemie_test_harness/tests/test_data/direct_tools/report_portal_tools_test_data.py +189 -197
  25. codemie_test_harness/tests/test_data/integrations_test_data.py +163 -2
  26. codemie_test_harness/tests/test_data/llm_test_data.py +1 -0
  27. codemie_test_harness/tests/test_data/open_api_tools_test_data.py +22 -1
  28. codemie_test_harness/tests/test_data/report_portal_tools_test_data.py +89 -112
  29. codemie_test_harness/tests/test_data/research_tools_test_data.py +29 -7
  30. codemie_test_harness/tests/utils/assistant_utils.py +22 -12
  31. codemie_test_harness/tests/utils/credentials_manager.py +66 -8
  32. codemie_test_harness/tests/utils/workflow_utils.py +91 -0
  33. codemie_test_harness/tests/workflow/assistant_tools/access_management/test_workflow_with_assistant_with_keycloak_tool.py +7 -0
  34. codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_test_plan_tools.py +50 -1
  35. codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_wiki_tools.py +39 -1
  36. codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_work_item_tools.py +34 -1
  37. codemie_test_harness/tests/workflow/assistant_tools/cloud/test_workflow_with_assistant_cloud_tools.py +6 -0
  38. codemie_test_harness/tests/workflow/assistant_tools/codebase/test_worfklow_with_assistant_codebase_tools.py +11 -0
  39. codemie_test_harness/tests/workflow/assistant_tools/data_management/test_workflow_with_assistant_with_data_management_tools.py +72 -1
  40. codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool.py +31 -0
  41. codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool_kit.py +31 -0
  42. codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool_with_datasource.py +26 -0
  43. codemie_test_harness/tests/workflow/assistant_tools/file_management/test_workflow_with_assistant_with_file_management_tools.py +63 -1
  44. codemie_test_harness/tests/workflow/assistant_tools/git/test_workflow_with_assistant_git_tools.py +82 -7
  45. codemie_test_harness/tests/workflow/assistant_tools/mcp/test_workflow_with_assistant_with_mcp_server.py +23 -4
  46. codemie_test_harness/tests/workflow/assistant_tools/notification/test_workflow_with_assistant_notification_tools.py +12 -0
  47. codemie_test_harness/tests/workflow/assistant_tools/open_api/test_workflow_with_assistant_with_open_api_tools.py +6 -0
  48. codemie_test_harness/tests/workflow/assistant_tools/plugin/test_workflow_with_assistant_with_development_plugin.py +29 -2
  49. codemie_test_harness/tests/workflow/assistant_tools/plugin/test_workflow_with_assistant_with_plugin_and_mcp_servers.py +14 -1
  50. codemie_test_harness/tests/workflow/assistant_tools/project_management/test_workflow_with_assistant_pm_tools.py +7 -0
  51. codemie_test_harness/tests/workflow/assistant_tools/report_portal/test_workflow_with_assistant_with_report_portal_tools.py +7 -0
  52. codemie_test_harness/tests/workflow/assistant_tools/research/test_workflow_with_assistant_research_tools.py +14 -1
  53. codemie_test_harness/tests/workflow/assistant_tools/servicenow/test_workflow_with_servicenow_tools.py +6 -0
  54. codemie_test_harness/tests/workflow/assistant_tools/vcs/workflow_with_assistant_vcs_tools.py +6 -0
  55. codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_cloud_tools.py +12 -9
  56. codemie_test_harness/tests/workflow/virtual_assistant_tools/access_management/test_workflow_with_keycloak_tool.py +8 -1
  57. codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_test_plan_tools.py +28 -1
  58. codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_wiki_tools.py +24 -1
  59. codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_work_item_tools.py +20 -1
  60. codemie_test_harness/tests/workflow/virtual_assistant_tools/cloud/test_workflow_with_cloud_tools.py +13 -4
  61. codemie_test_harness/tests/workflow/virtual_assistant_tools/codebase/test_workflow_with_codebase_tools.py +16 -1
  62. codemie_test_harness/tests/workflow/virtual_assistant_tools/data_management/test_workflow_with_data_management_tools.py +73 -1
  63. codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool.py +34 -1
  64. codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool_kit.py +34 -1
  65. codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool_with_datasource.py +34 -1
  66. codemie_test_harness/tests/workflow/virtual_assistant_tools/file_management/test_workflow_with_file_management_tools.py +101 -49
  67. codemie_test_harness/tests/workflow/virtual_assistant_tools/git/test_workflow_with_git_tools.py +42 -3
  68. codemie_test_harness/tests/workflow/virtual_assistant_tools/mcp/test_workflow_with_mcp_server.py +27 -5
  69. codemie_test_harness/tests/workflow/virtual_assistant_tools/notification/test_workflow_with_notification_tools.py +13 -0
  70. codemie_test_harness/tests/workflow/virtual_assistant_tools/open_api/test_workflow_with_open_api_tools.py +10 -1
  71. codemie_test_harness/tests/workflow/virtual_assistant_tools/plugin/test_workflow_with_development_plugin.py +20 -0
  72. codemie_test_harness/tests/workflow/virtual_assistant_tools/plugin/test_workflow_with_plugin_and_mcp_servers.py +14 -1
  73. codemie_test_harness/tests/workflow/virtual_assistant_tools/project_management/test_workflow_with_project_management_tools.py +10 -1
  74. codemie_test_harness/tests/workflow/virtual_assistant_tools/report_portal/test_workflow_with_report_portal_tool.py +10 -1
  75. codemie_test_harness/tests/workflow/virtual_assistant_tools/research/test_workflow_with_research_tools.py +9 -0
  76. codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py +10 -1
  77. codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py +9 -1
  78. {codemie_test_harness-0.1.184.dist-info → codemie_test_harness-0.1.198.dist-info}/METADATA +134 -3
  79. {codemie_test_harness-0.1.184.dist-info → codemie_test_harness-0.1.198.dist-info}/RECORD +81 -81
  80. {codemie_test_harness-0.1.184.dist-info → codemie_test_harness-0.1.198.dist-info}/WHEEL +0 -0
  81. {codemie_test_harness-0.1.184.dist-info → codemie_test_harness-0.1.198.dist-info}/entry_points.txt +0 -0
@@ -11,6 +11,7 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
11
11
  JIRA_TOOL_PROMPT,
12
12
  RESPONSE_FOR_JIRA_TOOL,
13
13
  )
14
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
14
15
  from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
15
16
  from codemie_test_harness.tests.utils.constants import test_project_name
16
17
 
@@ -79,6 +80,12 @@ def test_assistant_in_workflow_should_use_user_integration_by_default(
79
80
  response = workflow_utils.execute_workflow(
80
81
  workflow_with_assistant.id, jira_assistant.name
81
82
  )
83
+
84
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
85
+ workflow_with_assistant
86
+ )
87
+ assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
88
+
82
89
  similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
83
90
 
84
91
 
@@ -129,6 +136,12 @@ def test_assistant_in_workflow_with_global_and_project_integration(
129
136
  response = workflow_utils.execute_workflow(
130
137
  workflow_with_assistant.id, jira_assistant.name
131
138
  )
139
+
140
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
141
+ workflow_with_assistant
142
+ )
143
+ assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
144
+
132
145
  similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
133
146
 
134
147
 
@@ -170,6 +183,12 @@ def test_assistant_in_workflow_with_project_integration_only(
170
183
  response = workflow_utils.execute_workflow(
171
184
  workflow_with_assistant.id, jira_assistant.name
172
185
  )
186
+
187
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
188
+ workflow_with_assistant
189
+ )
190
+ assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
191
+
173
192
  similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
174
193
 
175
194
 
@@ -219,6 +238,12 @@ def test_assistant_in_workflow_with_global_valid_and_user_invalid_integration(
219
238
  response = workflow_utils.execute_workflow(
220
239
  workflow_with_assistant.id, jira_assistant.name
221
240
  )
241
+
242
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
243
+ workflow_with_assistant
244
+ )
245
+ assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
246
+
222
247
  similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
223
248
 
224
249
 
@@ -268,4 +293,10 @@ def test_assistant_in_workflow_with_project_valid_and_user_invalid_integration(
268
293
  response = workflow_utils.execute_workflow(
269
294
  workflow_with_assistant.id, jira_assistant.name
270
295
  )
296
+
297
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
298
+ workflow_with_assistant
299
+ )
300
+ assert_tool_triggered(ProjectManagementTool.JIRA, triggered_tools)
301
+
271
302
  similarity_check.check_similarity(response, RESPONSE_FOR_JIRA_TOOL)
@@ -10,6 +10,7 @@ from codemie_test_harness.tests.enums.tools import Toolkit, AzureDevOpsWikiTool
10
10
  from codemie_test_harness.tests.test_data.ado_wiki_tools_test_data import (
11
11
  ado_wiki_get_test_data,
12
12
  )
13
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
13
14
  from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
14
15
  from codemie_test_harness.tests.utils.constants import test_project_name
15
16
 
@@ -83,6 +84,12 @@ def test_assistant_in_workflow_should_use_user_integration_by_default(
83
84
  response = workflow_utils.execute_workflow(
84
85
  workflow_with_assistant.id, ado_assistant.name
85
86
  )
87
+
88
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
89
+ workflow_with_assistant
90
+ )
91
+ assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
92
+
86
93
  similarity_check.check_similarity(response, ado_wiki_answer)
87
94
 
88
95
 
@@ -134,6 +141,12 @@ def test_assistant_in_workflow_with_global_and_project_integration(
134
141
  response = workflow_utils.execute_workflow(
135
142
  workflow_with_assistant.id, ado_assistant.name
136
143
  )
144
+
145
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
146
+ workflow_with_assistant
147
+ )
148
+ assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
149
+
137
150
  similarity_check.check_similarity(response, ado_wiki_answer)
138
151
 
139
152
 
@@ -177,6 +190,12 @@ def test_assistant_in_workflow_with_project_integration_only(
177
190
  response = workflow_utils.execute_workflow(
178
191
  workflow_with_assistant.id, ado_assistant.name
179
192
  )
193
+
194
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
195
+ workflow_with_assistant
196
+ )
197
+ assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
198
+
180
199
  similarity_check.check_similarity(response, ado_wiki_answer)
181
200
 
182
201
 
@@ -228,6 +247,12 @@ def test_assistant_in_workflow_with_global_valid_and_user_invalid_integration(
228
247
  response = workflow_utils.execute_workflow(
229
248
  workflow_with_assistant.id, ado_assistant.name
230
249
  )
250
+
251
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
252
+ workflow_with_assistant
253
+ )
254
+ assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
255
+
231
256
  similarity_check.check_similarity(response, ado_wiki_answer)
232
257
 
233
258
 
@@ -279,4 +304,10 @@ def test_assistant_in_workflow_with_project_valid_and_user_invalid_integration(
279
304
  response = workflow_utils.execute_workflow(
280
305
  workflow_with_assistant.id, ado_assistant.name
281
306
  )
307
+
308
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
309
+ workflow_with_assistant
310
+ )
311
+ assert_tool_triggered(AzureDevOpsWikiTool.GET_WIKI, triggered_tools)
312
+
282
313
  similarity_check.check_similarity(response, ado_wiki_answer)
@@ -10,6 +10,7 @@ from codemie_test_harness.tests.enums.tools import Toolkit, GitTool
10
10
  from codemie_test_harness.tests.test_data.git_tools_test_data import (
11
11
  list_branches_set_active_branch_test_data,
12
12
  )
13
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
13
14
  from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
14
15
  from codemie_test_harness.tests.utils.constants import test_project_name
15
16
 
@@ -97,6 +98,31 @@ def test_assistant_in_workflow_should_use_user_integration_by_default(
97
98
  )
98
99
  similarity_check.check_similarity(response, git_tool_answer)
99
100
 
101
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
102
+ workflow_with_assistant
103
+ )
104
+ assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
105
+
106
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
107
+ workflow_with_assistant
108
+ )
109
+ assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
110
+
111
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
112
+ workflow_with_assistant
113
+ )
114
+ assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
115
+
116
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
117
+ workflow_with_assistant
118
+ )
119
+ assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
120
+
121
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
122
+ workflow_with_assistant
123
+ )
124
+ assert_tool_triggered(GitTool.LIST_BRANCHES_IN_REPO, triggered_tools)
125
+
100
126
 
101
127
  @pytest.mark.workflow
102
128
  @pytest.mark.workflow_with_assistant
@@ -15,7 +15,10 @@ from codemie_test_harness.tests.test_data.file_management_tools_test_data import
15
15
  RESPONSE_FOR_DIFF_UPDATE,
16
16
  RESPONSE_FOR_FILE_EDITOR,
17
17
  )
18
- from codemie_test_harness.tests.utils.base_utils import get_random_name
18
+ from codemie_test_harness.tests.utils.base_utils import (
19
+ get_random_name,
20
+ assert_tool_triggered,
21
+ )
19
22
  from codemie_test_harness.tests.utils.env_resolver import EnvironmentResolver
20
23
 
21
24
 
@@ -43,6 +46,11 @@ def test_workflow_with_assistant_with_file_management_tools(
43
46
  workflow_with_assistant.id, assistant.name
44
47
  )
45
48
 
49
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
50
+ workflow_with_assistant
51
+ )
52
+ assert_tool_triggered(tool_name, triggered_tools)
53
+
46
54
  similarity_check.check_similarity(response, expected_response)
47
55
 
48
56
 
@@ -72,6 +80,11 @@ def test_workflow_with_assistant_with_generate_image_tool(
72
80
  workflow_with_assistant.id, assistant.name
73
81
  )
74
82
 
83
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
84
+ workflow_with_assistant
85
+ )
86
+ assert_tool_triggered(FileManagementTool.GENERATE_IMAGE, triggered_tools)
87
+
75
88
  assert_that(
76
89
  response.lower(),
77
90
  all_of(
@@ -104,10 +117,23 @@ def test_workflow_with_assistant_with_read_file_tool(
104
117
  workflow_with_assistant.id, assistant.name, WRITE_FILE_TASK
105
118
  )
106
119
 
120
+ # Assert write file tool was triggered
121
+ write_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
122
+ workflow_with_assistant
123
+ )
124
+ assert_tool_triggered(FileManagementTool.WRITE_FILE, write_triggered_tools)
125
+
107
126
  # Step 2: Read file
108
127
  response = workflow_utils.execute_workflow(
109
128
  workflow_with_assistant.id, assistant.name, READ_FILE_TOOL_TASK
110
129
  )
130
+
131
+ # Assert read file tool was triggered
132
+ read_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
133
+ workflow_with_assistant
134
+ )
135
+ assert_tool_triggered(FileManagementTool.READ_FILE, read_triggered_tools)
136
+
111
137
  similarity_check.check_similarity(response, RESPONSE_FOR_READ_FILE_TASK)
112
138
 
113
139
 
@@ -137,16 +163,34 @@ def test_workflow_with_assistant_with_file_editing_tool(
137
163
  workflow_with_assistant.id, assistant.name, create_file_task(file_to_update)
138
164
  )
139
165
 
166
+ # Assert write file tool was triggered
167
+ create_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
168
+ workflow_with_assistant
169
+ )
170
+ assert_tool_triggered(FileManagementTool.WRITE_FILE, create_triggered_tools)
171
+
140
172
  # Insert to the file
141
173
  workflow_utils.execute_workflow(
142
174
  workflow_with_assistant.id, assistant.name, insert_to_file_task(file_to_update)
143
175
  )
144
176
 
177
+ # Assert diff update tool was triggered
178
+ insert_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
179
+ workflow_with_assistant
180
+ )
181
+ assert_tool_triggered(FileManagementTool.DIFF_UPDATE, insert_triggered_tools)
182
+
145
183
  # Show the diff
146
184
  response = workflow_utils.execute_workflow(
147
185
  workflow_with_assistant.id, assistant.name, show_diff_task(file_to_update)
148
186
  )
149
187
 
188
+ # Assert diff update tool was triggered again
189
+ diff_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
190
+ workflow_with_assistant
191
+ )
192
+ assert_tool_triggered(FileManagementTool.DIFF_UPDATE, diff_triggered_tools)
193
+
150
194
  similarity_check.check_similarity(response, RESPONSE_FOR_DIFF_UPDATE)
151
195
 
152
196
 
@@ -176,14 +220,32 @@ def test_workflow_with_assistant_with_filesystem_tool(
176
220
  workflow_with_assistant.id, assistant.name, create_file_task(file_to_update)
177
221
  )
178
222
 
223
+ # Assert filesystem editor tool was triggered
224
+ create_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
225
+ workflow_with_assistant
226
+ )
227
+ assert_tool_triggered(FileManagementTool.FILESYSTEM_EDITOR, create_triggered_tools)
228
+
179
229
  # Insert to the file
180
230
  workflow_utils.execute_workflow(
181
231
  workflow_with_assistant.id, assistant.name, insert_to_file_task(file_to_update)
182
232
  )
183
233
 
234
+ # Assert filesystem editor tool was triggered
235
+ insert_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
236
+ workflow_with_assistant
237
+ )
238
+ assert_tool_triggered(FileManagementTool.FILESYSTEM_EDITOR, insert_triggered_tools)
239
+
184
240
  # Show the file content
185
241
  response = workflow_utils.execute_workflow(
186
242
  workflow_with_assistant.id, assistant.name, show_file_task(file_to_update)
187
243
  )
188
244
 
245
+ # Assert filesystem editor tool was triggered
246
+ show_triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
247
+ workflow_with_assistant
248
+ )
249
+ assert_tool_triggered(FileManagementTool.FILESYSTEM_EDITOR, show_triggered_tools)
250
+
189
251
  similarity_check.check_similarity(response, RESPONSE_FOR_FILE_EDITOR)
@@ -1,6 +1,10 @@
1
1
  import pytest
2
2
  from hamcrest import assert_that, equal_to, not_none
3
- from codemie_test_harness.tests.utils.base_utils import get_random_name, to_camel_case
3
+ from codemie_test_harness.tests.utils.base_utils import (
4
+ get_random_name,
5
+ to_camel_case,
6
+ assert_tool_triggered,
7
+ )
4
8
  from codemie_test_harness.tests.test_data.git_tools_test_data import (
5
9
  list_branches_set_active_branch_test_data,
6
10
  create_branch_test_data,
@@ -44,6 +48,12 @@ def test_workflow_with_list_branch_set_active_branch_tools(
44
48
  response = workflow_utils.execute_workflow(
45
49
  workflow_with_assistant.id, assistant.name
46
50
  )
51
+
52
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
53
+ workflow_with_assistant
54
+ )
55
+ assert_tool_triggered(tool_name, triggered_tools)
56
+
47
57
  similarity_check.check_similarity(response, expected_response)
48
58
 
49
59
 
@@ -86,6 +96,11 @@ def test_workflow_with_create_branch_tool(
86
96
  workflow_with_assistant.id, assistant.name
87
97
  )
88
98
 
99
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
100
+ workflow_with_assistant
101
+ )
102
+ assert_tool_triggered(tool_name, triggered_tools)
103
+
89
104
  assert_that(
90
105
  git_utils.branch_exists(branch_name),
91
106
  equal_to(True),
@@ -141,6 +156,11 @@ def test_workflow_with_create_file_tool(
141
156
  workflow_with_assistant.id, assistant.name
142
157
  )
143
158
 
159
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
160
+ workflow_with_assistant
161
+ )
162
+ assert_tool_triggered(tool_name, triggered_tools)
163
+
144
164
  file_content = git_utils.get_file_content(file_name, "main")
145
165
 
146
166
  similarity_check.check_similarity(response, expected)
@@ -191,6 +211,12 @@ def test_workflow_with_create_merge_request_tool(
191
211
  response = workflow_utils.execute_workflow(
192
212
  workflow_with_assistant.id, assistant.name
193
213
  )
214
+
215
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
216
+ workflow_with_assistant
217
+ )
218
+ assert_tool_triggered(tool_name, triggered_tools)
219
+
194
220
  mr_id = git_utils.get_merge_request_id_by_title(mr_name)
195
221
 
196
222
  expected = expected_template(source_branch, mr_name, mr_id)
@@ -256,6 +282,11 @@ def test_workflow_with_delete_file_tool(
256
282
  workflow_with_assistant.id, assistant.name
257
283
  )
258
284
 
285
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
286
+ workflow_with_assistant
287
+ )
288
+ assert_tool_triggered(tool_name, triggered_tools)
289
+
259
290
  assert_that(
260
291
  git_utils.file_exists(file_name, "main"),
261
292
  equal_to(False),
@@ -309,7 +340,20 @@ def test_workflow_with_get_merge_request_changes_tool(
309
340
 
310
341
  create_mr_prompt = create_mr_prompt_template(source_branch, class_name, mr_name)
311
342
 
312
- response = assistant_utils.ask_assistant(assistant, create_mr_prompt)
343
+ # Create MR workflow step (first tool)
344
+ workflow_with_assistant_create = workflow_with_assistant(
345
+ assistant, create_mr_prompt
346
+ )
347
+ response = workflow_utils.execute_workflow(
348
+ workflow_with_assistant_create.id, assistant.name
349
+ )
350
+
351
+ # Assert first tool was triggered (create MR tool)
352
+ triggered_tools_create = workflow_utils.extract_triggered_tools_from_execution(
353
+ workflow_with_assistant_create
354
+ )
355
+ assert_tool_triggered(tool_name[:-1], triggered_tools_create)
356
+
313
357
  mr_id = git_utils.get_merge_request_id_by_title(mr_name)
314
358
 
315
359
  create_mr_expected = create_mr_expected_template(source_branch, mr_name, mr_id)
@@ -322,11 +366,20 @@ def test_workflow_with_get_merge_request_changes_tool(
322
366
  get_changes_prompt = get_mr_changes_prompt_template(mr_id)
323
367
  get_changes_expected = get_mr_changes_expected_template(class_name)
324
368
 
325
- workflow_with_assistant = workflow_with_assistant(assistant, get_changes_prompt)
369
+ # Get MR changes workflow step (second tool)
370
+ workflow_with_assistant_get = workflow_with_assistant(
371
+ assistant, get_changes_prompt
372
+ )
326
373
  response = workflow_utils.execute_workflow(
327
- workflow_with_assistant.id, assistant.name
374
+ workflow_with_assistant_get.id, assistant.name
328
375
  )
329
376
 
377
+ # Assert second tool was triggered (get MR changes tool)
378
+ triggered_tools_get = workflow_utils.extract_triggered_tools_from_execution(
379
+ workflow_with_assistant_get
380
+ )
381
+ assert_tool_triggered(tool_name[-1], triggered_tools_get)
382
+
330
383
  similarity_check.check_similarity(response, get_changes_expected)
331
384
  finally:
332
385
  if git_utils.branch_exists(source_branch):
@@ -374,7 +427,20 @@ def test_workflow_with_update_file_tools(
374
427
  )
375
428
 
376
429
  create_prompt = create_prompt_template(class_name)
377
- response = assistant_utils.ask_assistant(assistant, create_prompt)
430
+
431
+ # Create file workflow step (first tool)
432
+ workflow_with_assistant_create = workflow_with_assistant(
433
+ assistant, create_prompt
434
+ )
435
+ response = workflow_utils.execute_workflow(
436
+ workflow_with_assistant_create.id, assistant.name
437
+ )
438
+
439
+ # Assert create tool was triggered
440
+ triggered_tools_create = workflow_utils.extract_triggered_tools_from_execution(
441
+ workflow_with_assistant_create
442
+ )
443
+ assert_tool_triggered(tool_name[0], triggered_tools_create)
378
444
 
379
445
  create_expected = create_expected_template(class_name)
380
446
  similarity_check.check_similarity(response, create_expected)
@@ -391,10 +457,19 @@ def test_workflow_with_update_file_tools(
391
457
  update_prompt = update_prompt_template(class_name)
392
458
  update_expected = update_expected_template(class_name)
393
459
 
394
- workflow_with_assistant = workflow_with_assistant(assistant, update_prompt)
460
+ # Update file workflow step (second tool)
461
+ workflow_with_assistant_update = workflow_with_assistant(
462
+ assistant, update_prompt
463
+ )
395
464
  response = workflow_utils.execute_workflow(
396
- workflow_with_assistant.id, assistant.name
465
+ workflow_with_assistant_update.id, assistant.name
466
+ )
467
+
468
+ # Assert update tool was triggered
469
+ triggered_tools_update = workflow_utils.extract_triggered_tools_from_execution(
470
+ workflow_with_assistant_update
397
471
  )
472
+ assert_tool_triggered(tool_name[1], triggered_tools_update)
398
473
 
399
474
  similarity_check.check_similarity(response, update_expected)
400
475
 
@@ -1,5 +1,10 @@
1
1
  import pytest
2
2
 
3
+ from codemie_test_harness.tests.enums.tools import (
4
+ McpServerTime,
5
+ CliMcpServer,
6
+ McpServerFetch,
7
+ )
3
8
  from codemie_test_harness.tests.test_data.mcp_server_test_data import (
4
9
  FETCH_MCP_SERVER,
5
10
  fetch_expected_response,
@@ -12,10 +17,7 @@ from codemie_test_harness.tests.test_data.mcp_server_test_data import (
12
17
  cli_mcp_server_test_data,
13
18
  CLI_MCP_SERVER,
14
19
  )
15
-
16
- # pytestmark = pytest.mark.skipif(
17
- # EnvironmentResolver.is_localhost(), reason="Skipping this test on local environment"
18
- # )
20
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
19
21
 
20
22
 
21
23
  @pytest.mark.workflow
@@ -36,6 +38,11 @@ def test_workflow_with_assistant_with_time_mcp_server(
36
38
  workflow_with_assistant.id, assistant.name
37
39
  )
38
40
 
41
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
42
+ workflow_with_assistant
43
+ )
44
+ assert_tool_triggered(McpServerTime.CONVERT_TIME, triggered_tools)
45
+
39
46
  similarity_check.check_similarity(response, time_expected_response)
40
47
 
41
48
 
@@ -66,6 +73,12 @@ def test_workflow_with_assistant_with_cli_mcp_server(
66
73
  response = workflow_utils.execute_workflow(
67
74
  workflow_with_assistant.id, assistant.name, f"execute the command: '{command}'"
68
75
  )
76
+
77
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
78
+ workflow_with_assistant
79
+ )
80
+ assert_tool_triggered(CliMcpServer.RUN_COMMAND, triggered_tools)
81
+
69
82
  similarity_check.check_similarity(response, expected_answer)
70
83
 
71
84
 
@@ -86,4 +99,10 @@ def test_workflow_with_assistant_with_fetch_mcp_server(
86
99
  response = workflow_utils.execute_workflow(
87
100
  workflow_with_assistant.id, assistant.name
88
101
  )
102
+
103
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
104
+ workflow_with_assistant
105
+ )
106
+ assert_tool_triggered(McpServerFetch.FETCH, triggered_tools)
107
+
89
108
  similarity_check.check_similarity(response, fetch_expected_response)
@@ -13,6 +13,7 @@ from codemie_test_harness.tests.test_data.notification_tools_test_data import (
13
13
  TELEGRAM_TOOL_PROMPT,
14
14
  TELEGRAM_RESPONSE,
15
15
  )
16
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
16
17
 
17
18
 
18
19
  @pytest.mark.workflow
@@ -42,6 +43,12 @@ def test_workflow_with_email_tool(
42
43
  response = workflow_utils.execute_workflow(
43
44
  workflow_with_assistant_instance.id, assistant_instance.name
44
45
  )
46
+
47
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
48
+ workflow_with_assistant_instance
49
+ )
50
+ assert_tool_triggered(NotificationTool.EMAIL, triggered_tools)
51
+
45
52
  similarity_check.check_similarity(response, EMAIL_RESPONSE)
46
53
 
47
54
  message_data = gmail_message_operator.get_messages_list()
@@ -85,4 +92,9 @@ def test_workflow_with_telegram_tool(
85
92
  workflow_with_assistant_instance.id, assistant_instance.name
86
93
  )
87
94
 
95
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
96
+ workflow_with_assistant_instance
97
+ )
98
+ assert_tool_triggered(NotificationTool.TELEGRAM, triggered_tools)
99
+
88
100
  similarity_check.check_similarity(response, TELEGRAM_RESPONSE)
@@ -6,6 +6,7 @@ from codemie_test_harness.tests.enums.tools import Toolkit
6
6
  from codemie_test_harness.tests.test_data.open_api_tools_test_data import (
7
7
  open_api_tools_test_data,
8
8
  )
9
+ from codemie_test_harness.tests.utils.base_utils import assert_tool_triggered
9
10
 
10
11
 
11
12
  @pytest.mark.workflow
@@ -38,4 +39,9 @@ def test_workflow_with_assistant_with_open_api_tools(
38
39
  workflow_with_assistant.id, assistant.name, prompt
39
40
  )
40
41
 
42
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
43
+ workflow_with_assistant
44
+ )
45
+ assert_tool_triggered(tool_name, triggered_tools)
46
+
41
47
  similarity_check.check_similarity(response, expected_response)
@@ -2,12 +2,15 @@ import os
2
2
 
3
3
  import pytest
4
4
 
5
- from codemie_test_harness.tests.enums.tools import Toolkit
5
+ from codemie_test_harness.tests.enums.tools import Toolkit, PluginTool
6
6
  from codemie_test_harness.tests.test_data.plugin_tools_test_data import (
7
7
  list_files_plugin_tools_test_data,
8
8
  CREATE_READ_DELETE_FILE_TEST_DATA,
9
9
  )
10
- from codemie_test_harness.tests.utils.base_utils import get_random_name
10
+ from codemie_test_harness.tests.utils.base_utils import (
11
+ get_random_name,
12
+ assert_tool_triggered,
13
+ )
11
14
  from codemie_test_harness.tests.utils.constants import TESTS_PATH
12
15
 
13
16
 
@@ -36,6 +39,12 @@ def test_workflow_with_assistant_with_list_files_plugin_tools(
36
39
  response = workflow_utils.execute_workflow(
37
40
  workflow_with_assistant.id, assistant.name, prompt
38
41
  )
42
+
43
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
44
+ workflow_with_assistant
45
+ )
46
+ assert_tool_triggered(tool_name, triggered_tools)
47
+
39
48
  similarity_check.check_similarity(response, expected_response)
40
49
 
41
50
 
@@ -57,6 +66,7 @@ def test_workflow_with_assistant_with_modify_files_plugin_tools(
57
66
  )
58
67
  workflow_with_assistant = workflow_with_assistant(assistant, "Run")
59
68
 
69
+ # Step 1: Create file
60
70
  response = workflow_utils.execute_workflow(
61
71
  workflow_with_assistant.id,
62
72
  assistant.name,
@@ -65,6 +75,11 @@ def test_workflow_with_assistant_with_modify_files_plugin_tools(
65
75
  ),
66
76
  )
67
77
 
78
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
79
+ workflow_with_assistant
80
+ )
81
+ assert_tool_triggered(PluginTool.WRITE_FILE_TO_FILE_SYSTEM, triggered_tools)
82
+
68
83
  similarity_check.check_similarity(
69
84
  response,
70
85
  CREATE_READ_DELETE_FILE_TEST_DATA["create_file_response"].format(
@@ -72,6 +87,7 @@ def test_workflow_with_assistant_with_modify_files_plugin_tools(
72
87
  ),
73
88
  )
74
89
 
90
+ # Step 2: Run git command
75
91
  response = workflow_utils.execute_workflow(
76
92
  workflow_with_assistant.id,
77
93
  assistant.name,
@@ -80,11 +96,17 @@ def test_workflow_with_assistant_with_modify_files_plugin_tools(
80
96
  ),
81
97
  )
82
98
 
99
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
100
+ workflow_with_assistant
101
+ )
102
+ assert_tool_triggered(PluginTool.GENERIC_GIT_TOOL, triggered_tools)
103
+
83
104
  similarity_check.check_similarity(
84
105
  response,
85
106
  CREATE_READ_DELETE_FILE_TEST_DATA["git_command_response"].format(file_name),
86
107
  )
87
108
 
109
+ # Step 3: Show file content
88
110
  response = workflow_utils.execute_workflow(
89
111
  workflow_with_assistant.id,
90
112
  assistant.name,
@@ -93,6 +115,11 @@ def test_workflow_with_assistant_with_modify_files_plugin_tools(
93
115
  ].format(file_name),
94
116
  )
95
117
 
118
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
119
+ workflow_with_assistant
120
+ )
121
+ assert_tool_triggered(PluginTool.READ_FILE_FROM_FILE_SYSTEM, triggered_tools)
122
+
96
123
  similarity_check.check_similarity(
97
124
  response,
98
125
  CREATE_READ_DELETE_FILE_TEST_DATA["show_file_content_response"].format(