codemie-test-harness 0.1.212__py3-none-any.whl → 0.1.213__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/tools/project_management/test_assistant_pm_tools.py +4 -4
- codemie_test_harness/tests/conftest.py +14 -0
- codemie_test_harness/tests/test_data/pm_tools_test_data.py +45 -0
- codemie_test_harness/tests/test_data/project_management_test_data.py +41 -5
- codemie_test_harness/tests/utils/confluence_utils.py +128 -0
- codemie_test_harness/tests/utils/jira_utils.py +128 -0
- {codemie_test_harness-0.1.212.dist-info → codemie_test_harness-0.1.213.dist-info}/METADATA +2 -2
- {codemie_test_harness-0.1.212.dist-info → codemie_test_harness-0.1.213.dist-info}/RECORD +10 -8
- {codemie_test_harness-0.1.212.dist-info → codemie_test_harness-0.1.213.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.212.dist-info → codemie_test_harness-0.1.213.dist-info}/entry_points.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import pytest
|
|
2
|
-
|
|
3
2
|
from codemie_sdk.models.assistant import ToolConfig
|
|
4
3
|
from codemie_sdk.models.integration import CredentialTypes
|
|
4
|
+
|
|
5
5
|
from codemie_test_harness.tests.enums.tools import Toolkit, ProjectManagementTool
|
|
6
6
|
from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
7
7
|
CONFLUENCE_TOOL_PROMPT,
|
|
@@ -13,7 +13,6 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
|
13
13
|
from codemie_test_harness.tests.test_data.project_management_test_data import (
|
|
14
14
|
pm_tools_test_data,
|
|
15
15
|
)
|
|
16
|
-
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
17
16
|
from codemie_test_harness.tests.utils.base_utils import (
|
|
18
17
|
credentials_to_dict,
|
|
19
18
|
assert_tool_triggered,
|
|
@@ -21,6 +20,7 @@ from codemie_test_harness.tests.utils.base_utils import (
|
|
|
21
20
|
from codemie_test_harness.tests.utils.constants import (
|
|
22
21
|
project_management_integrations,
|
|
23
22
|
)
|
|
23
|
+
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
@pytest.mark.assistant
|
|
@@ -41,14 +41,14 @@ def test_assistant_with_project_management_tools(
|
|
|
41
41
|
prompt,
|
|
42
42
|
expected_response,
|
|
43
43
|
):
|
|
44
|
-
|
|
44
|
+
_integration = request.getfixturevalue(
|
|
45
45
|
project_management_integrations[integration_type]
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
assistant = assistant(
|
|
49
49
|
Toolkit.PROJECT_MANAGEMENT,
|
|
50
50
|
tool_name,
|
|
51
|
-
settings=
|
|
51
|
+
settings=_integration,
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
response, triggered_tools = assistant_utils.ask_assistant(
|
|
@@ -31,6 +31,7 @@ from codemie_test_harness.tests.test_data.google_datasource_test_data import (
|
|
|
31
31
|
from codemie_test_harness.tests.utils.assistant_utils import AssistantUtils
|
|
32
32
|
from codemie_test_harness.tests.utils.base_utils import get_random_name, wait_for_entity
|
|
33
33
|
from codemie_test_harness.tests.utils.client_factory import get_client
|
|
34
|
+
from codemie_test_harness.tests.utils.confluence_utils import ConfluenceUtils
|
|
34
35
|
from codemie_test_harness.tests.utils.constants import TESTS_PATH, FILES_PATH
|
|
35
36
|
from codemie_test_harness.tests.utils.conversation_utils import ConversationUtils
|
|
36
37
|
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
@@ -41,6 +42,7 @@ from codemie_test_harness.tests.utils.env_resolver import (
|
|
|
41
42
|
)
|
|
42
43
|
from codemie_test_harness.tests.utils.gitbud_utils import GitBudUtils
|
|
43
44
|
from codemie_test_harness.tests.utils.integration_utils import IntegrationUtils
|
|
45
|
+
from codemie_test_harness.tests.utils.jira_utils import JiraUtils
|
|
44
46
|
from codemie_test_harness.tests.utils.llm_utils import LLMUtils
|
|
45
47
|
from codemie_test_harness.tests.utils.logger_util import setup_logger
|
|
46
48
|
from codemie_test_harness.tests.utils.notification_utils import GmailUtils
|
|
@@ -967,3 +969,15 @@ def pytest_sessionfinish(session):
|
|
|
967
969
|
|
|
968
970
|
providers_utils = ProviderUtils(client)
|
|
969
971
|
providers_utils.cleanup_test_providers()
|
|
972
|
+
|
|
973
|
+
# Clean up Jira test issues
|
|
974
|
+
jira_utils = JiraUtils(is_cloud=False)
|
|
975
|
+
jira_utils.cleanup_jira_project(summary_prefix=prefix)
|
|
976
|
+
jira_utils = JiraUtils(is_cloud=True)
|
|
977
|
+
jira_utils.cleanup_jira_project(summary_prefix=prefix)
|
|
978
|
+
|
|
979
|
+
# Clean up Confluence test pages
|
|
980
|
+
confluence_utils = ConfluenceUtils(is_cloud=False)
|
|
981
|
+
confluence_utils.cleanup_confluence_space(title_prefix=prefix)
|
|
982
|
+
confluence_utils = ConfluenceUtils(is_cloud=True)
|
|
983
|
+
confluence_utils.cleanup_confluence_space(title_prefix=prefix)
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
from codemie_test_harness.tests.utils.base_utils import get_random_name
|
|
2
|
+
from codemie_test_harness.tests.utils.confluence_utils import CONFLUENCE_SPACE_KEYS
|
|
3
|
+
from codemie_test_harness.tests.utils.jira_utils import JIRA_PROJECT_KEYS
|
|
4
|
+
|
|
1
5
|
JIRA_TOOL_PROMPT = (
|
|
2
6
|
"Get a title for ticket EPMCDME-222 ticket."
|
|
3
7
|
"For generic jira tool use exactly the same parameters:"
|
|
@@ -89,3 +93,44 @@ RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL = """
|
|
|
89
93
|
Description: This space includes a section for describing the purpose of the space, a search feature, and a filter by label functionality.
|
|
90
94
|
If you need more detailed information about a specific page, please let me know!
|
|
91
95
|
"""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def get_jira_tool_create_prompt(jira_type: str) -> str:
|
|
99
|
+
return (
|
|
100
|
+
"Create a new issue in Jira with the following details. "
|
|
101
|
+
"For generic jira tool use exactly the same parameters: "
|
|
102
|
+
"relative_url=/rest/api/2/issue "
|
|
103
|
+
"method=POST "
|
|
104
|
+
f"params={{'fields': {{'project': {{'key': '{JIRA_PROJECT_KEYS[jira_type]}'}}, 'summary': '{get_random_name()} Test issue created by automation', "
|
|
105
|
+
"'description': 'This is a test issue created for testing purposes', 'issuetype': {'name': 'Task'}}}}}"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def get_response_for_jira_tool_create(jira_type: str) -> str:
|
|
110
|
+
return f"""
|
|
111
|
+
The issue has been successfully created in Jira. Here are the details:
|
|
112
|
+
|
|
113
|
+
- **ID**: 13411639
|
|
114
|
+
- **Key**: {JIRA_PROJECT_KEYS[jira_type]}-.....
|
|
115
|
+
- **Link**: [{JIRA_PROJECT_KEYS[jira_type]}-.....](https://jira.....)
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def get_confluence_tool_create_prompt(confluence_type: str) -> str:
|
|
120
|
+
return f"""
|
|
121
|
+
Create a new page in Confluence with the following details using Generic Confluence Tool with the params:
|
|
122
|
+
relative_url='/rest/api/content'
|
|
123
|
+
method='POST'
|
|
124
|
+
params={{'type': 'page', 'title': '{get_random_name()} Test Page Created by Automation', 'space': {{'key': '{CONFLUENCE_SPACE_KEYS[confluence_type]}'}},
|
|
125
|
+
'body': {{'storage': {{'value': '<p>This is a test page created for testing purposes.</p>', 'representation': 'storage'}}}}}}
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def get_response_for_confluence_tool_create(confluence_type: str) -> str:
|
|
130
|
+
return f"""
|
|
131
|
+
Successfully created a new page in Confluence.
|
|
132
|
+
The page has been created with the following details:
|
|
133
|
+
- Title: Test Page Created by Automation
|
|
134
|
+
- Space: {CONFLUENCE_SPACE_KEYS[confluence_type]}
|
|
135
|
+
- Content: This is a test page created for testing purposes.
|
|
136
|
+
"""
|
|
@@ -2,14 +2,18 @@ import pytest
|
|
|
2
2
|
|
|
3
3
|
from codemie_test_harness.tests.enums.tools import ProjectManagementTool
|
|
4
4
|
from codemie_test_harness.tests.test_data.pm_tools_test_data import (
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
get_confluence_tool_create_prompt,
|
|
6
|
+
get_response_for_confluence_tool_create,
|
|
7
|
+
CONFLUENCE_CLOUD_TOOL_PROMPT,
|
|
8
|
+
RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
|
|
7
9
|
CONFLUENCE_TOOL_PROMPT,
|
|
8
10
|
RESPONSE_FOR_CONFLUENCE_TOOL,
|
|
9
|
-
|
|
11
|
+
get_jira_tool_create_prompt,
|
|
12
|
+
get_response_for_jira_tool_create,
|
|
13
|
+
JIRA_TOOL_PROMPT,
|
|
14
|
+
RESPONSE_FOR_JIRA_TOOL,
|
|
10
15
|
JIRA_CLOUD_TOOL_PROMPT,
|
|
11
|
-
|
|
12
|
-
RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
|
|
16
|
+
RESPONSE_FOR_JIRA_CLOUD_TOOL,
|
|
13
17
|
)
|
|
14
18
|
from codemie_test_harness.tests.utils.constants import ProjectManagementIntegrationType
|
|
15
19
|
|
|
@@ -46,4 +50,36 @@ pm_tools_test_data = [
|
|
|
46
50
|
marks=[pytest.mark.confluence, pytest.mark.confluence_cloud],
|
|
47
51
|
id=ProjectManagementIntegrationType.CONFLUENCE_CLOUD,
|
|
48
52
|
),
|
|
53
|
+
pytest.param(
|
|
54
|
+
ProjectManagementTool.JIRA,
|
|
55
|
+
ProjectManagementIntegrationType.JIRA,
|
|
56
|
+
get_jira_tool_create_prompt("server"),
|
|
57
|
+
get_response_for_jira_tool_create("server"),
|
|
58
|
+
marks=[pytest.mark.jira],
|
|
59
|
+
id=f"{ProjectManagementIntegrationType.JIRA.value} - create",
|
|
60
|
+
),
|
|
61
|
+
pytest.param(
|
|
62
|
+
ProjectManagementTool.JIRA,
|
|
63
|
+
ProjectManagementIntegrationType.JIRA_CLOUD,
|
|
64
|
+
get_jira_tool_create_prompt("cloud"),
|
|
65
|
+
get_response_for_jira_tool_create("cloud"),
|
|
66
|
+
marks=[pytest.mark.jira, pytest.mark.jira_cloud],
|
|
67
|
+
id=f"{ProjectManagementIntegrationType.JIRA_CLOUD.value} - create",
|
|
68
|
+
),
|
|
69
|
+
pytest.param(
|
|
70
|
+
ProjectManagementTool.CONFLUENCE,
|
|
71
|
+
ProjectManagementIntegrationType.CONFLUENCE,
|
|
72
|
+
get_confluence_tool_create_prompt("server"),
|
|
73
|
+
get_response_for_confluence_tool_create("server"),
|
|
74
|
+
marks=[pytest.mark.confluence],
|
|
75
|
+
id=f"{ProjectManagementIntegrationType.CONFLUENCE.value} - create",
|
|
76
|
+
),
|
|
77
|
+
pytest.param(
|
|
78
|
+
ProjectManagementTool.CONFLUENCE,
|
|
79
|
+
ProjectManagementIntegrationType.CONFLUENCE_CLOUD,
|
|
80
|
+
get_confluence_tool_create_prompt("cloud"),
|
|
81
|
+
get_response_for_confluence_tool_create("cloud"),
|
|
82
|
+
marks=[pytest.mark.confluence, pytest.mark.confluence_cloud],
|
|
83
|
+
id=f"{ProjectManagementIntegrationType.CONFLUENCE_CLOUD.value} - create",
|
|
84
|
+
),
|
|
49
85
|
]
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
6
|
+
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
CONFLUENCE_SPACE_KEYS = {"server": "EPMCDMETST", "cloud": "CODEMIE"}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ConfluenceUtils:
|
|
13
|
+
"""Utility class for interacting with Confluence API."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, is_cloud: bool = False):
|
|
16
|
+
"""
|
|
17
|
+
Initialize Confluence utilities with credentials from CredentialsManager.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
is_cloud: Whether to use Confluence Cloud or Confluence Server credentials
|
|
21
|
+
"""
|
|
22
|
+
self.is_cloud = is_cloud
|
|
23
|
+
|
|
24
|
+
if is_cloud:
|
|
25
|
+
self.confluence_url = CredentialsManager.get_parameter(
|
|
26
|
+
"CONFLUENCE_CLOUD_URL"
|
|
27
|
+
)
|
|
28
|
+
self.token = CredentialsManager.get_parameter("CONFLUENCE_CLOUD_TOKEN")
|
|
29
|
+
self.email = CredentialsManager.get_parameter("CONFLUENCE_CLOUD_EMAIL")
|
|
30
|
+
self.auth = (self.email, self.token)
|
|
31
|
+
self.headers = {
|
|
32
|
+
"Accept": "application/json",
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
}
|
|
35
|
+
self.confluence_api = "/wiki/api/v2"
|
|
36
|
+
self.pages_endpoint = "/pages"
|
|
37
|
+
self.space_key = CONFLUENCE_SPACE_KEYS["cloud"]
|
|
38
|
+
else:
|
|
39
|
+
self.confluence_url = CredentialsManager.get_parameter("CONFLUENCE_URL")
|
|
40
|
+
self.token = CredentialsManager.get_parameter("CONFLUENCE_TOKEN")
|
|
41
|
+
self.email = None
|
|
42
|
+
self.auth = None
|
|
43
|
+
self.headers = {
|
|
44
|
+
"Authorization": f"Bearer {self.token}",
|
|
45
|
+
"Accept": "application/json",
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
}
|
|
48
|
+
self.confluence_api = "/rest/api"
|
|
49
|
+
self.pages_endpoint = "/content"
|
|
50
|
+
self.space_key = CONFLUENCE_SPACE_KEYS["server"]
|
|
51
|
+
|
|
52
|
+
def delete_confluence_page(self, page_id: str):
|
|
53
|
+
"""
|
|
54
|
+
Delete a Confluence page via Confluence API.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
page_id: The Confluence page ID
|
|
58
|
+
"""
|
|
59
|
+
# Construct API endpoint
|
|
60
|
+
endpoint = (
|
|
61
|
+
f"{self.confluence_url}{self.confluence_api}{self.pages_endpoint}/{page_id}"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
logger.info(f"Deleting Confluence page: {page_id}")
|
|
66
|
+
requests.delete(
|
|
67
|
+
url=endpoint,
|
|
68
|
+
headers=self.headers,
|
|
69
|
+
auth=self.auth,
|
|
70
|
+
verify=True,
|
|
71
|
+
)
|
|
72
|
+
except requests.exceptions.RequestException as e:
|
|
73
|
+
logger.error(f"Error deleting Confluence page {page_id}: {str(e)}")
|
|
74
|
+
|
|
75
|
+
def cleanup_confluence_space(self, title_prefix: str, space_key: str = None):
|
|
76
|
+
"""
|
|
77
|
+
Clean up Confluence pages in a space with title starting with specified prefix.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
title_prefix: The prefix to filter pages by title (e.g., autotest_entity_prefix)
|
|
81
|
+
space_key: The Confluence space key (e.g., 'TEST')
|
|
82
|
+
"""
|
|
83
|
+
space_key = self.space_key if not space_key else space_key
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
# Search for pages in the space
|
|
87
|
+
search_endpoint = (
|
|
88
|
+
f"{self.confluence_url}{self.confluence_api}{self.pages_endpoint}"
|
|
89
|
+
)
|
|
90
|
+
params = {
|
|
91
|
+
"spaceKey": space_key,
|
|
92
|
+
"type": "page",
|
|
93
|
+
"limit": 100,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
logger.info(
|
|
97
|
+
f"Searching for Confluence pages in space {space_key} with title starting with '{title_prefix}'"
|
|
98
|
+
)
|
|
99
|
+
response = requests.get(
|
|
100
|
+
url=search_endpoint,
|
|
101
|
+
headers=self.headers,
|
|
102
|
+
auth=self.auth,
|
|
103
|
+
params=params,
|
|
104
|
+
verify=True,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
if response.status_code == 200:
|
|
108
|
+
all_pages = response.json().get("results", [])
|
|
109
|
+
|
|
110
|
+
# Filter pages by title prefix
|
|
111
|
+
pages_to_delete = [
|
|
112
|
+
page
|
|
113
|
+
for page in all_pages
|
|
114
|
+
if page.get("title", "").startswith(title_prefix)
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
# Delete each page
|
|
118
|
+
for page in pages_to_delete:
|
|
119
|
+
self.delete_confluence_page(page["id"])
|
|
120
|
+
else:
|
|
121
|
+
logger.error(
|
|
122
|
+
f"Failed to search for pages. Status: {response.status_code}, Response: {response.text}"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
except requests.exceptions.RequestException as e:
|
|
126
|
+
logger.error(
|
|
127
|
+
f"Error during Confluence cleanup for space {space_key}: {str(e)}"
|
|
128
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
|
|
6
|
+
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
JIRA_PROJECT_KEYS = {"server": "EPMCDMETST", "cloud": "SCRUM"}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class JiraUtils:
|
|
13
|
+
"""Utility class for interacting with Jira API."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, is_cloud: bool = False):
|
|
16
|
+
"""
|
|
17
|
+
Initialize Jira utilities with credentials from CredentialsManager.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
is_cloud: Whether to use Jira Cloud or Jira Server credentials
|
|
21
|
+
"""
|
|
22
|
+
self.is_cloud = is_cloud
|
|
23
|
+
|
|
24
|
+
if is_cloud:
|
|
25
|
+
self.jira_url = CredentialsManager.get_parameter("JIRA_CLOUD_URL")
|
|
26
|
+
self.token = CredentialsManager.get_parameter("JIRA_CLOUD_TOKEN")
|
|
27
|
+
self.email = CredentialsManager.get_parameter("JIRA_CLOUD_EMAIL")
|
|
28
|
+
self.auth = (self.email, self.token)
|
|
29
|
+
self.headers = {
|
|
30
|
+
"Accept": "application/json",
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
}
|
|
33
|
+
self.jira_api = "/rest/api/3"
|
|
34
|
+
self.search_endpoint = "/search/jql"
|
|
35
|
+
self.project_key = JIRA_PROJECT_KEYS["cloud"]
|
|
36
|
+
else:
|
|
37
|
+
self.jira_url = CredentialsManager.get_parameter("JIRA_URL")
|
|
38
|
+
self.token = CredentialsManager.get_parameter("JIRA_TOKEN")
|
|
39
|
+
self.email = None
|
|
40
|
+
self.auth = None
|
|
41
|
+
self.headers = {
|
|
42
|
+
"Authorization": f"Bearer {self.token}",
|
|
43
|
+
"Accept": "application/json",
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
}
|
|
46
|
+
self.jira_api = "/rest/api/2"
|
|
47
|
+
self.search_endpoint = "/search"
|
|
48
|
+
self.project_key = JIRA_PROJECT_KEYS["server"]
|
|
49
|
+
|
|
50
|
+
def delete_jira_item(self, issue_key: str):
|
|
51
|
+
"""
|
|
52
|
+
Delete a Jira issue via Jira API.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
issue_key: The Jira issue key (e.g., 'PROJ-123')
|
|
56
|
+
"""
|
|
57
|
+
# Construct API endpoint
|
|
58
|
+
endpoint = f"{self.jira_url}{self.jira_api}/issue/{issue_key}"
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
logger.info(f"Deleting Jira issue: {issue_key}")
|
|
62
|
+
requests.delete(
|
|
63
|
+
url=endpoint,
|
|
64
|
+
headers=self.headers,
|
|
65
|
+
auth=self.auth,
|
|
66
|
+
verify=True,
|
|
67
|
+
)
|
|
68
|
+
except requests.exceptions.RequestException as e:
|
|
69
|
+
logger.error(f"Error deleting Jira issue {issue_key}: {str(e)}")
|
|
70
|
+
|
|
71
|
+
def cleanup_jira_project(self, summary_prefix: str, project_key: str = None):
|
|
72
|
+
"""
|
|
73
|
+
Clean up Jira issues in a project with summary starting with specified prefix.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
project_key: The Jira project key (e.g., 'EPMCDMETST')
|
|
77
|
+
summary_prefix: The prefix to filter issues by summary (e.g., autotest_entity_prefix)
|
|
78
|
+
"""
|
|
79
|
+
# Construct JQL query to find all issues in the project
|
|
80
|
+
# We'll filter by summary prefix in Python since JQL text search has limitations
|
|
81
|
+
project_key = self.project_key if not project_key else project_key
|
|
82
|
+
|
|
83
|
+
jql = f'project = "{project_key}"'
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
# Search for issues matching the JQL
|
|
87
|
+
search_endpoint = f"{self.jira_url}{self.jira_api}{self.search_endpoint}"
|
|
88
|
+
params = {
|
|
89
|
+
"jql": jql,
|
|
90
|
+
"maxResults": 100,
|
|
91
|
+
"fields": "key,summary",
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
logger.info(
|
|
95
|
+
f"Searching for Jira issues in project {project_key} with summary starting with '{summary_prefix}'"
|
|
96
|
+
)
|
|
97
|
+
response = requests.get(
|
|
98
|
+
url=search_endpoint,
|
|
99
|
+
headers=self.headers,
|
|
100
|
+
auth=self.auth,
|
|
101
|
+
params=params,
|
|
102
|
+
verify=True,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if response.status_code == 200:
|
|
106
|
+
all_issues = response.json().get("issues", [])
|
|
107
|
+
|
|
108
|
+
# Filter issues by summary prefix in Python
|
|
109
|
+
issues_to_delete = [
|
|
110
|
+
issue
|
|
111
|
+
for issue in all_issues
|
|
112
|
+
if issue.get("fields", {})
|
|
113
|
+
.get("summary", "")
|
|
114
|
+
.startswith(summary_prefix)
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
# Delete each issue
|
|
118
|
+
for issue in issues_to_delete:
|
|
119
|
+
self.delete_jira_item(issue["key"])
|
|
120
|
+
else:
|
|
121
|
+
logger.error(
|
|
122
|
+
f"Failed to search for issues. Status: {response.status_code}, Response: {response.text}"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
except requests.exceptions.RequestException as e:
|
|
126
|
+
logger.error(
|
|
127
|
+
f"Error during Jira cleanup for project {project_key}: {str(e)}"
|
|
128
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: codemie-test-harness
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.213
|
|
4
4
|
Summary: Autotest for CodeMie backend and UI
|
|
5
5
|
Author: Anton Yeromin
|
|
6
6
|
Author-email: anton_yeromin@epam.com
|
|
@@ -13,7 +13,7 @@ Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
|
|
|
13
13
|
Requires-Dist: boto3 (>=1.39.8,<2.0.0)
|
|
14
14
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
15
15
|
Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
|
|
16
|
-
Requires-Dist: codemie-sdk-python (==0.1.
|
|
16
|
+
Requires-Dist: codemie-sdk-python (==0.1.213)
|
|
17
17
|
Requires-Dist: pytest (>=8.4.1,<9.0.0)
|
|
18
18
|
Requires-Dist: pytest-playwright (>=0.7.0,<0.8.0)
|
|
19
19
|
Requires-Dist: pytest-repeat (>=0.9.3,<0.10.0)
|
|
@@ -55,7 +55,7 @@ codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_developmen
|
|
|
55
55
|
codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_plugin_and_mcp_servers.py,sha256=YjKlVactCaPZhRXLu3GQXrPPgVHkUrbTgwhNbz-OP84,2239
|
|
56
56
|
codemie_test_harness/tests/assistant/tools/plugin/test_single_assistant_dual_time_plugins.py,sha256=6CmNPIaFXpJdvCmV1xu48v8mXWxL0O83ecQYthENvPE,5386
|
|
57
57
|
codemie_test_harness/tests/assistant/tools/project_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
-
codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py,sha256=
|
|
58
|
+
codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py,sha256=gmoNr2XEZA2hgKtlnY9ULZnQW_rId9v6O5dvZdKokjk,6024
|
|
59
59
|
codemie_test_harness/tests/assistant/tools/report_portal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
60
|
codemie_test_harness/tests/assistant/tools/report_portal/test_assistant_report_portal_tools.py,sha256=bGv3MS7hV3yX5S3QwaeoWkA273QCOKYAew7M4BhDUso,969
|
|
61
61
|
codemie_test_harness/tests/assistant/tools/research/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -64,7 +64,7 @@ codemie_test_harness/tests/assistant/tools/servicenow/__init__.py,sha256=47DEQpj
|
|
|
64
64
|
codemie_test_harness/tests/assistant/tools/servicenow/test_servicenow_tools.py,sha256=aUjfZ4773WoQJjcHx3JqH5e8ckaKB-aIMO-OZWTm0Ek,888
|
|
65
65
|
codemie_test_harness/tests/assistant/tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
66
|
codemie_test_harness/tests/assistant/tools/vcs/test_assistant_with_vcs_tools.py,sha256=qOPr4XOh2rgUV2MXMxkRzRGkAKl9ViwQGCZ-dMEtscU,1145
|
|
67
|
-
codemie_test_harness/tests/conftest.py,sha256=
|
|
67
|
+
codemie_test_harness/tests/conftest.py,sha256=zSOjH7Pak73BtntTPNBdBS488xJag28jNsJRzTOvh5E,32640
|
|
68
68
|
codemie_test_harness/tests/conversations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
69
|
codemie_test_harness/tests/conversations/test_conversations_endpoints.py,sha256=HQ2nu9lXfRNkyJhA0rzar7Rmv6pMe-te0rFYAy-X5UA,4128
|
|
70
70
|
codemie_test_harness/tests/e2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -161,8 +161,8 @@ codemie_test_harness/tests/test_data/open_api_tools_test_data.py,sha256=mvf0legy
|
|
|
161
161
|
codemie_test_harness/tests/test_data/openapi.json,sha256=X4uqtfjpTUuMifefQRf8mHI1k8pspp8-L0rpJlhLOI4,10459
|
|
162
162
|
codemie_test_harness/tests/test_data/output_schema_test_data.py,sha256=4l7AvXbMl9hIvoFxu1LPPSGz9hb5Uz2_is4zTm77ARY,261
|
|
163
163
|
codemie_test_harness/tests/test_data/plugin_tools_test_data.py,sha256=bVamztyQ4bAVo1CRSrtu6f5H-gkjhAN2nq5Jbc0erqM,4168
|
|
164
|
-
codemie_test_harness/tests/test_data/pm_tools_test_data.py,sha256=
|
|
165
|
-
codemie_test_harness/tests/test_data/project_management_test_data.py,sha256=
|
|
164
|
+
codemie_test_harness/tests/test_data/pm_tools_test_data.py,sha256=SnXG0knX7uMb-jMvbmE1OObzYQZQSCDQtD0tL2XTvIo,5256
|
|
165
|
+
codemie_test_harness/tests/test_data/project_management_test_data.py,sha256=2RWzrJmdlrOuJQKcmlWOfYz2daw_Oc2RkDU5XyM-w6U,3242
|
|
166
166
|
codemie_test_harness/tests/test_data/report_portal_tools_test_data.py,sha256=YZdmfEwrwOdCduNxs768LOB8OHfL8sfNI-R2k-koKTk,14555
|
|
167
167
|
codemie_test_harness/tests/test_data/research_tools_test_data.py,sha256=zwpzm-VSnrLZEfG97AE9Ms7z7j3xmqxiNd1EmZyWCSk,9102
|
|
168
168
|
codemie_test_harness/tests/test_data/servicenow_tools_test_data.py,sha256=PKw9zEYSNcQM1KApCSjsBiA_3Py0bNQI7clqw8cmT-s,1983
|
|
@@ -271,6 +271,7 @@ codemie_test_harness/tests/utils/assistant_utils.py,sha256=2s1MikCfIcM3Ulkcuwaed
|
|
|
271
271
|
codemie_test_harness/tests/utils/aws_parameters_store.py,sha256=YAVpvwElkKZJZvzSVxtOue1Gjs-kvSBS2y5QvIlz484,3267
|
|
272
272
|
codemie_test_harness/tests/utils/base_utils.py,sha256=SJV-m8KuC6MAU4W5a1sWLz6Nw-1-buc0f-W1hbA1OIY,8270
|
|
273
273
|
codemie_test_harness/tests/utils/client_factory.py,sha256=xGta0ZaVYzWfwJ4cu3f89KkGc_R5Bq-9lqnhr57x_2w,972
|
|
274
|
+
codemie_test_harness/tests/utils/confluence_utils.py,sha256=auhip1ntqSDsHWAoWCxQxfuNv05BinS6TWXyg_F2dfc,4544
|
|
274
275
|
codemie_test_harness/tests/utils/constants.py,sha256=aGs0gdHB38Ozd-UyCKNpWRoQXMy3D0bjmfxiPcdZdqY,1165
|
|
275
276
|
codemie_test_harness/tests/utils/conversation_utils.py,sha256=SWj6TBWOQoX5Yh6Wk63yHQFveRXgK1mpLb3PUKAa57A,648
|
|
276
277
|
codemie_test_harness/tests/utils/credentials_manager.py,sha256=xF7fjQbT4b1rPrOOQfo3ie5c06FLjUzppvTaJDVOg2s,55252
|
|
@@ -281,6 +282,7 @@ codemie_test_harness/tests/utils/file_utils.py,sha256=hY-kwnyzvtd1BQif8r5NhvRTGf
|
|
|
281
282
|
codemie_test_harness/tests/utils/gitbud_utils.py,sha256=-2nHX79FHLwoLN9crbTO4Q9scLXNmNgkw8N1_JUTqys,7972
|
|
282
283
|
codemie_test_harness/tests/utils/http_utils.py,sha256=wjhttibzzNhleKzWgWC01Q0Y5sV9scu-Ski-qgJPd-Q,4179
|
|
283
284
|
codemie_test_harness/tests/utils/integration_utils.py,sha256=FN9OORtIahATyjzfvwVmJ96mX0BTjk_xDPTQYBLS_8E,4417
|
|
285
|
+
codemie_test_harness/tests/utils/jira_utils.py,sha256=-n8Kqi7HZstRgrP4KClbijGbHpGMqgvoaYcN1CnHx8c,4635
|
|
284
286
|
codemie_test_harness/tests/utils/json_utils.py,sha256=PWO4Ixxgta_zkdq-8umcP9qwDSi9JFxMuaT2NW3v1eI,226
|
|
285
287
|
codemie_test_harness/tests/utils/llm_utils.py,sha256=JPAlMYh-wQH4any5HWdpQOejCbhjqJCsztRU_fUq-SU,257
|
|
286
288
|
codemie_test_harness/tests/utils/logger_util.py,sha256=6Kca4pLxyTYnUgm2i3j19DdZSH6XUSGXPjHtExx33QU,828
|
|
@@ -400,7 +402,7 @@ codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/__init__.
|
|
|
400
402
|
codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py,sha256=D835gaRbCnB4va5mi9TdA_u9StSpGXQ_fgzwW0S2pwo,1173
|
|
401
403
|
codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
402
404
|
codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py,sha256=Se9imIiBYuJU78m1pLu0g4ZmHygKZjr6JjIWkGXTy1Q,1364
|
|
403
|
-
codemie_test_harness-0.1.
|
|
404
|
-
codemie_test_harness-0.1.
|
|
405
|
-
codemie_test_harness-0.1.
|
|
406
|
-
codemie_test_harness-0.1.
|
|
405
|
+
codemie_test_harness-0.1.213.dist-info/METADATA,sha256=yFQaB6HKgMkLqmiIDGbo0-wu4bwEWhyGznZEIxz7FiI,27184
|
|
406
|
+
codemie_test_harness-0.1.213.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
407
|
+
codemie_test_harness-0.1.213.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
|
|
408
|
+
codemie_test_harness-0.1.213.dist-info/RECORD,,
|
|
File without changes
|
{codemie_test_harness-0.1.212.dist-info → codemie_test_harness-0.1.213.dist-info}/entry_points.txt
RENAMED
|
File without changes
|