codemie-test-harness 0.1.179__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/cli/cli.py +2 -0
- codemie_test_harness/cli/commands/marks_cmd.py +39 -0
- codemie_test_harness/cli/marks_utils.py +338 -0
- codemie_test_harness/cli/runner.py +40 -0
- codemie_test_harness/tests/assistant/datasource/test_code_datasource.py +20 -7
- codemie_test_harness/tests/assistant/datasource/test_confluence_datasource.py +20 -7
- codemie_test_harness/tests/assistant/datasource/test_file_indexing.py +20 -9
- codemie_test_harness/tests/assistant/datasource/test_google_datasource.py +21 -7
- codemie_test_harness/tests/assistant/datasource/test_jira_datasource.py +22 -9
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool.py +29 -13
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool_kit.py +29 -13
- codemie_test_harness/tests/assistant/default_integrations/test_default_integrations_for_tool_with_datasource.py +29 -13
- codemie_test_harness/tests/assistant/test_assistants.py +53 -35
- codemie_test_harness/tests/assistant/tools/access_management/test_keycloak_tool.py +7 -2
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_test_plan_tools.py +39 -11
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_wiki_tools.py +27 -8
- codemie_test_harness/tests/assistant/tools/ado/test_assistant_for_ado_work_item_tools.py +27 -7
- codemie_test_harness/tests/assistant/tools/cloud/test_cloud_tools.py +9 -3
- codemie_test_harness/tests/assistant/tools/codebase/test_codebase_tools.py +13 -4
- codemie_test_harness/tests/assistant/tools/datamanagement/test_assistant_with_data_management_tools.py +32 -11
- codemie_test_harness/tests/assistant/tools/filemanagement/test_assistant_with_file_management_tools.py +37 -12
- codemie_test_harness/tests/assistant/tools/git/test_assistant_with_git_tools.py +48 -17
- codemie_test_harness/tests/assistant/tools/mcp/test_cli_mcp_server.py +16 -9
- codemie_test_harness/tests/assistant/tools/mcp/test_mcp_servers.py +14 -8
- codemie_test_harness/tests/assistant/tools/notification/test_assistant_notification_tools.py +11 -4
- codemie_test_harness/tests/assistant/tools/openapi/test_assistant_with_open_api_tools.py +6 -2
- codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_development_plugin.py +27 -8
- codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_plugin_and_mcp_servers.py +17 -5
- codemie_test_harness/tests/assistant/tools/plugin/test_single_assistant_dual_time_plugins.py +12 -3
- codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py +36 -17
- codemie_test_harness/tests/assistant/tools/report_portal/test_assistant_report_portal_tools.py +7 -2
- codemie_test_harness/tests/assistant/tools/research/test_assistant_research_tools.py +17 -5
- codemie_test_harness/tests/assistant/tools/servicenow/test_servicenow_tools.py +6 -2
- codemie_test_harness/tests/assistant/tools/vcs/test_assistant_with_vcs_tools.py +7 -2
- codemie_test_harness/tests/conversations/test_conversations_endpoints.py +5 -5
- codemie_test_harness/tests/e2e/test_e2e.py +6 -6
- codemie_test_harness/tests/enums/tools.py +32 -0
- codemie_test_harness/tests/integrations/project/test_default_integrations.py +14 -14
- codemie_test_harness/tests/integrations/project/test_project_integrations.py +9 -9
- codemie_test_harness/tests/integrations/user/test_default_integrations.py +14 -14
- codemie_test_harness/tests/integrations/user/test_user_integrations.py +12 -12
- codemie_test_harness/tests/llm/assistants/test_lite_llm.py +2 -2
- codemie_test_harness/tests/llm/assistants/test_llm.py +3 -3
- codemie_test_harness/tests/providers/test_providers_endpoints.py +11 -11
- codemie_test_harness/tests/search/test_search_assistant.py +1 -1
- codemie_test_harness/tests/search/test_search_datasource.py +5 -5
- codemie_test_harness/tests/search/test_search_integration.py +2 -2
- codemie_test_harness/tests/search/test_search_workflow.py +1 -1
- codemie_test_harness/tests/service/test_assistant_service.py +1 -1
- codemie_test_harness/tests/test_data/codebase_tools_test_data.py +11 -5
- codemie_test_harness/tests/test_data/file_test_data.py +17 -0
- codemie_test_harness/tests/ui/assistants/test_create_assistant.py +11 -11
- codemie_test_harness/tests/ui/datasource/test_create_datasource.py +7 -7
- codemie_test_harness/tests/ui/datasource/test_datasource_page.py +3 -3
- codemie_test_harness/tests/ui/datasource/test_edit_datasource.py +5 -5
- codemie_test_harness/tests/ui/datasource/test_view_datasource.py +5 -5
- codemie_test_harness/tests/ui/integrations/test_create_integration.py +9 -9
- codemie_test_harness/tests/ui/workflows/test_create_workflow.py +12 -12
- codemie_test_harness/tests/ui/workflows/test_edit_workflow.py +15 -15
- codemie_test_harness/tests/ui/workflows/test_workflow_details.py +19 -19
- codemie_test_harness/tests/ui/workflows/test_workflow_executions_page.py +36 -36
- codemie_test_harness/tests/ui/workflows/test_workflow_templates.py +8 -8
- codemie_test_harness/tests/ui/workflows/test_workflows.py +8 -8
- codemie_test_harness/tests/utils/assistant_utils.py +34 -1
- codemie_test_harness/tests/utils/base_utils.py +61 -0
- codemie_test_harness/tests/workflow/assistant_tools/access_management/test_workflow_with_assistant_with_keycloak_tool.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_test_plan_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_wiki_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/ado/test_workflow_with_assistant_with_ado_work_item_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/cloud/test_workflow_with_assistant_cloud_tools.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/codebase/test_worfklow_with_assistant_codebase_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/data_management/test_workflow_with_assistant_with_data_management_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool.py +8 -8
- codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool_kit.py +8 -8
- codemie_test_harness/tests/workflow/assistant_tools/default_integrations/test_default_integrations_for_tool_with_datasource.py +8 -8
- codemie_test_harness/tests/workflow/assistant_tools/file_management/test_workflow_with_assistant_with_file_management_tools.py +5 -5
- codemie_test_harness/tests/workflow/assistant_tools/git/test_workflow_with_assistant_git_tools.py +7 -7
- codemie_test_harness/tests/workflow/assistant_tools/mcp/test_workflow_with_assistant_with_mcp_server.py +3 -3
- codemie_test_harness/tests/workflow/assistant_tools/notification/test_workflow_with_assistant_notification_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/open_api/test_workflow_with_assistant_with_open_api_tools.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/plugin/test_workflow_with_assistant_with_development_plugin.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/plugin/test_workflow_with_assistant_with_plugin_and_mcp_servers.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/project_management/test_workflow_with_assistant_pm_tools.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/report_portal/test_workflow_with_assistant_with_report_portal_tools.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/research/test_workflow_with_assistant_research_tools.py +2 -2
- codemie_test_harness/tests/workflow/assistant_tools/servicenow/test_workflow_with_servicenow_tools.py +1 -1
- codemie_test_harness/tests/workflow/assistant_tools/vcs/workflow_with_assistant_vcs_tools.py +1 -1
- codemie_test_harness/tests/workflow/config_validation/test_config_validation.py +1 -1
- codemie_test_harness/tests/workflow/direct_tools_calling/default_integrations/test_default_integrations_for_tool.py +8 -8
- codemie_test_harness/tests/workflow/direct_tools_calling/default_integrations/test_default_integrations_for_tool_kit.py +8 -8
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_access_management_tool.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_ado_test_plan_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_ado_wiki_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_ado_work_item_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_cloud_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_codebase_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_data_management_tools_elastic.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_data_management_tools_sql.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_file_management_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_notification_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_open_api_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_plugin_tools.py +4 -4
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_project_management_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_report_portal_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_research_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_servicenow_tools.py +3 -3
- codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_vcs_tools.py +3 -3
- codemie_test_harness/tests/workflow/test_workflows.py +1 -1
- codemie_test_harness/tests/workflow/virtual_assistant_tools/access_management/test_workflow_with_keycloak_tool.py +1 -1
- codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_test_plan_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_wiki_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/ado/test_workflow_with_ado_work_item_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/cloud/test_workflow_with_cloud_tools.py +4 -4
- codemie_test_harness/tests/workflow/virtual_assistant_tools/codebase/test_workflow_with_codebase_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/data_management/test_workflow_with_data_management_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool.py +8 -8
- codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool_kit.py +8 -8
- codemie_test_harness/tests/workflow/virtual_assistant_tools/default_integrations/test_default_integrations_for_tool_with_datasource.py +8 -8
- codemie_test_harness/tests/workflow/virtual_assistant_tools/file_management/test_workflow_with_file_management_tools.py +5 -5
- codemie_test_harness/tests/workflow/virtual_assistant_tools/git/test_workflow_with_git_tools.py +7 -7
- codemie_test_harness/tests/workflow/virtual_assistant_tools/mcp/test_workflow_with_mcp_server.py +3 -3
- codemie_test_harness/tests/workflow/virtual_assistant_tools/notification/test_workflow_with_notification_tools.py +4 -4
- codemie_test_harness/tests/workflow/virtual_assistant_tools/open_api/test_workflow_with_open_api_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/plugin/test_workflow_with_development_plugin.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/plugin/test_workflow_with_plugin_and_mcp_servers.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/project_management/test_workflow_with_project_management_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/report_portal/test_workflow_with_report_portal_tool.py +1 -1
- codemie_test_harness/tests/workflow/virtual_assistant_tools/research/test_workflow_with_research_tools.py +2 -2
- codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py +1 -1
- codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py +1 -1
- {codemie_test_harness-0.1.179.dist-info → codemie_test_harness-0.1.181.dist-info}/METADATA +8 -8
- {codemie_test_harness-0.1.179.dist-info → codemie_test_harness-0.1.181.dist-info}/RECORD +134 -132
- {codemie_test_harness-0.1.179.dist-info → codemie_test_harness-0.1.181.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.179.dist-info → codemie_test_harness-0.1.181.dist-info}/entry_points.txt +0 -0
|
@@ -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(),
|
|
@@ -28,7 +29,7 @@ pytestmark = pytest.mark.skipif(
|
|
|
28
29
|
|
|
29
30
|
@pytest.mark.assistant
|
|
30
31
|
@pytest.mark.elastic
|
|
31
|
-
@pytest.mark.
|
|
32
|
+
@pytest.mark.api
|
|
32
33
|
@pytest.mark.testcase("EPMCDME-6132")
|
|
33
34
|
def test_create_assistant_with_elastic_tool(
|
|
34
35
|
integration_utils, assistant, assistant_utils, similarity_check
|
|
@@ -43,14 +44,17 @@ 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
|
|
|
51
55
|
@pytest.mark.assistant
|
|
52
56
|
@pytest.mark.sql
|
|
53
|
-
@pytest.mark.
|
|
57
|
+
@pytest.mark.api
|
|
54
58
|
@pytest.mark.testcase("EPMCDME-6132")
|
|
55
59
|
@pytest.mark.parametrize(
|
|
56
60
|
"db_dialect",
|
|
@@ -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,13 +14,16 @@ 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
|
|
|
21
24
|
@pytest.mark.assistant
|
|
22
25
|
@pytest.mark.file_management
|
|
23
|
-
@pytest.mark.
|
|
26
|
+
@pytest.mark.api
|
|
24
27
|
@pytest.mark.testcase("EPMCDME-6103")
|
|
25
28
|
@pytest.mark.parametrize(
|
|
26
29
|
"tool_name,prompt,expected_response",
|
|
@@ -39,14 +42,17 @@ 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
|
|
|
47
53
|
@pytest.mark.assistant
|
|
48
54
|
@pytest.mark.file_management
|
|
49
|
-
@pytest.mark.
|
|
55
|
+
@pytest.mark.api
|
|
50
56
|
@pytest.mark.testcase("EPMCDME-6103")
|
|
51
57
|
@pytest.mark.skipif(
|
|
52
58
|
EnvironmentResolver.is_localhost(), reason="Skipping this test on local environment"
|
|
@@ -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(),
|
|
@@ -73,7 +83,7 @@ def test_create_assistant_with_file_management_generate_image_tool(
|
|
|
73
83
|
|
|
74
84
|
@pytest.mark.assistant
|
|
75
85
|
@pytest.mark.file_management
|
|
76
|
-
@pytest.mark.
|
|
86
|
+
@pytest.mark.api
|
|
77
87
|
@pytest.mark.testcase("EPMCDME-6103")
|
|
78
88
|
def test_create_assistant_with_file_management_read_file_tool(
|
|
79
89
|
filesystem_integration, assistant, assistant_utils, similarity_check
|
|
@@ -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
|
|
|
@@ -94,7 +110,7 @@ def test_create_assistant_with_file_management_read_file_tool(
|
|
|
94
110
|
@pytest.mark.skip(reason="Tests are flaky, tools work unstable")
|
|
95
111
|
@pytest.mark.assistant
|
|
96
112
|
@pytest.mark.file_management
|
|
97
|
-
@pytest.mark.
|
|
113
|
+
@pytest.mark.api
|
|
98
114
|
@pytest.mark.parametrize(
|
|
99
115
|
"tool_name,expected_response",
|
|
100
116
|
file_editing_tools_test_data,
|
|
@@ -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,12 +10,16 @@ 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
|
|
17
21
|
@pytest.mark.gitlab
|
|
18
|
-
@pytest.mark.
|
|
22
|
+
@pytest.mark.api
|
|
19
23
|
@pytest.mark.parametrize(
|
|
20
24
|
"toolkit,tool_name,prompt,expected_response",
|
|
21
25
|
list_branches_set_active_branch_test_data,
|
|
@@ -40,13 +44,16 @@ 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
|
|
|
47
54
|
@pytest.mark.assistant
|
|
48
55
|
@pytest.mark.gitlab
|
|
49
|
-
@pytest.mark.
|
|
56
|
+
@pytest.mark.api
|
|
50
57
|
@pytest.mark.parametrize(
|
|
51
58
|
"toolkit,tool_name,prompt_template,expected_template",
|
|
52
59
|
create_branch_test_data,
|
|
@@ -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),
|
|
@@ -92,7 +102,7 @@ def test_assistant_with_create_branch_tool(
|
|
|
92
102
|
|
|
93
103
|
@pytest.mark.assistant
|
|
94
104
|
@pytest.mark.gitlab
|
|
95
|
-
@pytest.mark.
|
|
105
|
+
@pytest.mark.api
|
|
96
106
|
@pytest.mark.parametrize(
|
|
97
107
|
"toolkit,tool_name,prompt_template,expected_template,expected_content_template",
|
|
98
108
|
create_file_test_data,
|
|
@@ -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
|
|
|
@@ -140,7 +153,7 @@ def test_assistant_with_create_file_tool(
|
|
|
140
153
|
|
|
141
154
|
@pytest.mark.assistant
|
|
142
155
|
@pytest.mark.gitlab
|
|
143
|
-
@pytest.mark.
|
|
156
|
+
@pytest.mark.api
|
|
144
157
|
@pytest.mark.parametrize(
|
|
145
158
|
"toolkit,tool_name,prompt_template,expected_template",
|
|
146
159
|
create_merge_request_test_data,
|
|
@@ -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)
|
|
@@ -184,7 +200,7 @@ def test_assistant_with_create_merge_request_tool(
|
|
|
184
200
|
|
|
185
201
|
@pytest.mark.assistant
|
|
186
202
|
@pytest.mark.gitlab
|
|
187
|
-
@pytest.mark.
|
|
203
|
+
@pytest.mark.api
|
|
188
204
|
@pytest.mark.parametrize(
|
|
189
205
|
"toolkit,tool_name,prompt_template,expected_template,file_content_template",
|
|
190
206
|
delete_file_test_data,
|
|
@@ -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"),
|
|
@@ -247,7 +266,7 @@ def test_assistant_with_delete_file_tool(
|
|
|
247
266
|
|
|
248
267
|
@pytest.mark.assistant
|
|
249
268
|
@pytest.mark.gitlab
|
|
250
|
-
@pytest.mark.
|
|
269
|
+
@pytest.mark.api
|
|
251
270
|
@pytest.mark.parametrize(
|
|
252
271
|
"toolkit,tool_name,create_mr_prompt_template,create_mr_expected_template,get_mr_changes_prompt_template,get_mr_changes_expected_template",
|
|
253
272
|
get_merge_request_changes_test_data,
|
|
@@ -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):
|
|
@@ -304,7 +329,7 @@ def test_assistant_with_get_merge_request_changes_tool(
|
|
|
304
329
|
|
|
305
330
|
@pytest.mark.assistant
|
|
306
331
|
@pytest.mark.gitlab
|
|
307
|
-
@pytest.mark.
|
|
332
|
+
@pytest.mark.api
|
|
308
333
|
@pytest.mark.parametrize(
|
|
309
334
|
"toolkit,tool_name,create_prompt_template,create_expected_template,created_content_template,update_prompt_template,update_expected_template,updated_content_template",
|
|
310
335
|
update_file_test_data,
|
|
@@ -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,21 +7,24 @@ 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
|
|
23
26
|
@pytest.mark.mcp
|
|
24
|
-
@pytest.mark.
|
|
27
|
+
@pytest.mark.api
|
|
25
28
|
@pytest.mark.parametrize(
|
|
26
29
|
"command,expected_answer",
|
|
27
30
|
cli_mcp_server_test_data,
|
|
@@ -31,17 +34,19 @@ 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
|
|
|
42
47
|
@pytest.mark.assistant
|
|
43
48
|
@pytest.mark.mcp
|
|
44
|
-
@pytest.mark.
|
|
49
|
+
@pytest.mark.api
|
|
45
50
|
def test_env_var_in_mcp_server(
|
|
46
51
|
assistant_utils, assistant, similarity_check, integration_utils
|
|
47
52
|
):
|
|
@@ -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,14 +12,14 @@ 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
|
|
20
21
|
@pytest.mark.mcp
|
|
21
|
-
@pytest.mark.
|
|
22
|
+
@pytest.mark.api
|
|
22
23
|
@pytest.mark.parametrize(
|
|
23
24
|
"mcp_server",
|
|
24
25
|
time_mcp_server_test_data,
|
|
@@ -31,20 +32,25 @@ 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
|
|
|
42
45
|
@pytest.mark.assistant
|
|
43
46
|
@pytest.mark.mcp
|
|
44
|
-
@pytest.mark.
|
|
47
|
+
@pytest.mark.api
|
|
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,
|
|
@@ -19,7 +20,7 @@ from codemie_test_harness.tests.test_data.notification_tools_test_data import (
|
|
|
19
20
|
@pytest.mark.assistant
|
|
20
21
|
@pytest.mark.notification
|
|
21
22
|
@pytest.mark.email
|
|
22
|
-
@pytest.mark.
|
|
23
|
+
@pytest.mark.api
|
|
23
24
|
@pytest.mark.skipif(
|
|
24
25
|
get_environment() in [Environment.LOCALHOST, Environment.GCP],
|
|
25
26
|
reason="Skipping this test on local environment",
|
|
@@ -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()
|
|
@@ -65,7 +69,7 @@ def test_assistant_with_email_tool(
|
|
|
65
69
|
@pytest.mark.assistant
|
|
66
70
|
@pytest.mark.notification
|
|
67
71
|
@pytest.mark.telegram
|
|
68
|
-
@pytest.mark.
|
|
72
|
+
@pytest.mark.api
|
|
69
73
|
def test_assistant_with_telegram_tool(
|
|
70
74
|
assistant, assistant_utils, similarity_check, integration_utils
|
|
71
75
|
):
|
|
@@ -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
|
|
|
@@ -10,7 +11,7 @@ from codemie_test_harness.tests.test_data.open_api_tools_test_data import (
|
|
|
10
11
|
|
|
11
12
|
@pytest.mark.assistant
|
|
12
13
|
@pytest.mark.openapi
|
|
13
|
-
@pytest.mark.
|
|
14
|
+
@pytest.mark.api
|
|
14
15
|
@pytest.mark.testcase("EPMCDME-6127")
|
|
15
16
|
@pytest.mark.skipif(
|
|
16
17
|
EnvironmentResolver.is_azure(),
|
|
@@ -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)
|
|
@@ -2,18 +2,21 @@ 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
|
|
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
|
|
|
14
17
|
@pytest.mark.assistant
|
|
15
18
|
@pytest.mark.plugin
|
|
16
|
-
@pytest.mark.
|
|
19
|
+
@pytest.mark.api
|
|
17
20
|
@pytest.mark.parametrize(
|
|
18
21
|
"prompt,expected_response,tool_name",
|
|
19
22
|
list_files_plugin_tools_test_data,
|
|
@@ -31,13 +34,18 @@ def test_assistant_with_list_files_plugin_tools(
|
|
|
31
34
|
):
|
|
32
35
|
assistant = assistant(Toolkit.PLUGIN, Toolkit.PLUGIN, settings=development_plugin)
|
|
33
36
|
|
|
34
|
-
response = assistant_utils.ask_assistant(
|
|
37
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
38
|
+
assistant, prompt, minimal_response=False
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
assert_tool_triggered(tool_name, triggered_tools)
|
|
42
|
+
|
|
35
43
|
similarity_check.check_similarity(response, expected_response)
|
|
36
44
|
|
|
37
45
|
|
|
38
46
|
@pytest.mark.assistant
|
|
39
47
|
@pytest.mark.plugin
|
|
40
|
-
@pytest.mark.
|
|
48
|
+
@pytest.mark.api
|
|
41
49
|
@pytest.mark.plugin
|
|
42
50
|
def test_assistant_with_modify_files_plugin_tools(
|
|
43
51
|
assistant_utils,
|
|
@@ -51,12 +59,16 @@ def test_assistant_with_modify_files_plugin_tools(
|
|
|
51
59
|
Toolkit.PLUGIN, Toolkit.PLUGIN, settings=development_plugin
|
|
52
60
|
)
|
|
53
61
|
|
|
54
|
-
response = assistant_utils.ask_assistant(
|
|
62
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
55
63
|
assistant,
|
|
56
64
|
CREATE_READ_DELETE_FILE_TEST_DATA["create_file_prompt"].format(
|
|
57
65
|
file_name, file_name
|
|
58
66
|
),
|
|
67
|
+
minimal_response=False,
|
|
59
68
|
)
|
|
69
|
+
|
|
70
|
+
assert_tool_triggered(PluginTool.WRITE_FILE_TO_FILE_SYSTEM, triggered_tools)
|
|
71
|
+
|
|
60
72
|
similarity_check.check_similarity(
|
|
61
73
|
response,
|
|
62
74
|
CREATE_READ_DELETE_FILE_TEST_DATA["create_file_response"].format(
|
|
@@ -64,21 +76,28 @@ def test_assistant_with_modify_files_plugin_tools(
|
|
|
64
76
|
),
|
|
65
77
|
)
|
|
66
78
|
|
|
67
|
-
response = assistant_utils.ask_assistant(
|
|
79
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
68
80
|
assistant,
|
|
69
81
|
CREATE_READ_DELETE_FILE_TEST_DATA["git_command_prompt"].format(file_name),
|
|
82
|
+
minimal_response=False,
|
|
70
83
|
)
|
|
84
|
+
assert_tool_triggered(PluginTool.GENERIC_GIT_TOOL, triggered_tools)
|
|
85
|
+
|
|
71
86
|
similarity_check.check_similarity(
|
|
72
87
|
response,
|
|
73
88
|
CREATE_READ_DELETE_FILE_TEST_DATA["git_command_response"].format(file_name),
|
|
74
89
|
)
|
|
75
90
|
|
|
76
|
-
response = assistant_utils.ask_assistant(
|
|
91
|
+
response, triggered_tools = assistant_utils.ask_assistant(
|
|
77
92
|
assistant,
|
|
78
93
|
CREATE_READ_DELETE_FILE_TEST_DATA["show_file_content_prompt"].format(
|
|
79
94
|
file_name
|
|
80
95
|
),
|
|
96
|
+
minimal_response=False,
|
|
81
97
|
)
|
|
98
|
+
|
|
99
|
+
assert_tool_triggered(PluginTool.READ_FILE_FROM_FILE_SYSTEM, triggered_tools)
|
|
100
|
+
|
|
82
101
|
similarity_check.check_similarity(
|
|
83
102
|
response,
|
|
84
103
|
CREATE_READ_DELETE_FILE_TEST_DATA["show_file_content_response"].format(
|