alita-sdk 0.3.161__py3-none-any.whl → 0.3.163__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.
@@ -0,0 +1,135 @@
1
+ from typing import List, Literal
2
+
3
+ from pydantic import model_validator, create_model, Field, SecretStr, BaseModel, PrivateAttr
4
+
5
+ from .zephyr_squad_cloud_client import ZephyrSquadCloud
6
+ from ..elitea_base import BaseToolApiWrapper
7
+
8
+
9
+ class ZephyrSquadApiWrapper(BaseToolApiWrapper):
10
+ account_id: str
11
+ access_key: str
12
+ secret_key: SecretStr
13
+ _client: ZephyrSquadCloud = PrivateAttr()
14
+
15
+ @model_validator(mode='before')
16
+ @classmethod
17
+ def validate_toolkit(cls, values):
18
+ account_id = values.get("account_id", None)
19
+ access_key = values.get("access_key", None)
20
+ secret_key = values.get("secret_key", None)
21
+ if not account_id:
22
+ raise ValueError("account_id is required.")
23
+ if not access_key:
24
+ raise ValueError("access_key is required.")
25
+ if not secret_key:
26
+ raise ValueError("secret_key is required.")
27
+ cls._client = ZephyrSquadCloud(
28
+ account_id=account_id,
29
+ access_key=access_key,
30
+ secret_key=secret_key
31
+ )
32
+ return values
33
+
34
+ def get_test_step(self, issue_id, step_id, project_id):
35
+ """Retrieve details for a specific test step in a Jira test case."""
36
+ return self._client.get_test_step(issue_id, step_id, project_id)
37
+
38
+ def update_test_step(self, issue_id, step_id, project_id, json):
39
+ """Update the content or a specific test step in a Jira test case."""
40
+ return self._client.update_test_step(issue_id, step_id, project_id, json)
41
+
42
+ def delete_test_step(self, issue_id, step_id, project_id):
43
+ """Remove a specific test step from a Jira test case."""
44
+ return self._client.delete_test_step(issue_id, step_id, project_id)
45
+
46
+ def create_new_test_step(self, issue_id, project_id, json):
47
+ """Add a new test step to a Jira test case."""
48
+ return self._client.create_new_test_step(issue_id, project_id, json)
49
+
50
+ def get_all_test_steps(self, issue_id, project_id):
51
+ """List all test steps associated with a Jira test case."""
52
+ return self._client.get_all_test_steps(issue_id, project_id)
53
+
54
+ def get_all_test_step_statuses(self):
55
+ """Retrieve all possible statuses for test steps in Jira."""
56
+ return self._client.get_all_test_step_statuses()
57
+
58
+ def get_available_tools(self):
59
+ return [
60
+ {
61
+ "name": "get_test_step",
62
+ "description": self.get_test_step.__doc__,
63
+ "args_schema": ProjectIssueStep,
64
+ "ref": self.get_test_step,
65
+ },
66
+ {
67
+ "name": "update_test_step",
68
+ "description": self.update_test_step.__doc__,
69
+ "args_schema": UpdateTestStep,
70
+ "ref": self.update_test_step,
71
+ },
72
+ {
73
+ "name": "delete_test_step",
74
+ "description": self.delete_test_step.__doc__,
75
+ "args_schema": ProjectIssueStep,
76
+ "ref": self.delete_test_step,
77
+ },
78
+ {
79
+ "name": "create_new_test_step",
80
+ "description": self.create_new_test_step.__doc__,
81
+ "args_schema": CreateNewTestStep,
82
+ "ref": self.create_new_test_step,
83
+ },
84
+ {
85
+ "name": "get_all_test_steps",
86
+ "description": self.get_all_test_steps.__doc__,
87
+ "args_schema": ProjectIssue,
88
+ "ref": self.get_all_test_steps,
89
+ },
90
+ {
91
+ "name": "get_all_test_step_statuses",
92
+ "description": self.get_all_test_step_statuses.__doc__,
93
+ "args_schema": create_model("NoInput"),
94
+ "ref": self.get_all_test_step_statuses,
95
+ }
96
+ ]
97
+
98
+
99
+ ProjectIssue = create_model(
100
+ "ProjectIssue",
101
+ issue_id=(int, Field(description="Jira ticket id of test case to which the test step belongs.")),
102
+ project_id=(int, Field(description="Jira project id to which test case belongs."))
103
+ )
104
+
105
+ ProjectIssueStep = create_model(
106
+ "ProjectIssueStep",
107
+ step_id=(str, Field(description="Test step id to operate.")),
108
+ __base__=ProjectIssue
109
+ )
110
+
111
+ UpdateTestStep = create_model(
112
+ "UpdateTestStep",
113
+ json=(str, Field(description=(
114
+ "JSON body to update a Zephyr test step. Fields:\n"
115
+ "- id (string, required): Unique identifier for the test step. Example: \"0001481146115453-3a0480a3ffffc384-0001\"\n"
116
+ "- step (string, required): Description of the test step. Example: \"Sample Test Step\"\n"
117
+ "- data (string, optional): Test data used in this step. Example: \"Sample Test Data\"\n"
118
+ "- result (string, optional): Expected result after executing the step. Example: \"Expected Test Result\"\n"
119
+ "- customFieldValues (array[object], optional): List of custom field values for the test step. Each object contains:\n"
120
+ " - customFieldId (string, required): ID of the custom field. Example: \"3ce1c679-7c43-4d37-89f6-757603379e31\"\n"
121
+ " - value (object, required): Value for the custom field. Example: {\"value\": \"08/21/2018\"}\n"
122
+ "*IMPORTANT*: Use double quotes for all field names and string values."))),
123
+ __base__=ProjectIssueStep
124
+ )
125
+
126
+ CreateNewTestStep = create_model(
127
+ "CreateNewTestStep",
128
+ json=(str, Field(description=(
129
+ "JSON body to create a Zephyr test step. Fields:\n"
130
+ "- step (string, required): Description of the test step. Example: \"Sample Test Step\"\n"
131
+ "- data (string, optional): Test data used in this step. Example: \"Sample Test Data\"\n"
132
+ "- result (string, optional): Expected result after executing the step. Example: \"Expected Test Result\"\n"
133
+ "*IMPORTANT*: Use double quotes for all field names and string values."))),
134
+ __base__=ProjectIssue
135
+ )
@@ -0,0 +1,79 @@
1
+ import hashlib
2
+ import time
3
+
4
+ import jwt
5
+ import requests
6
+ from langchain_core.tools import ToolException
7
+
8
+
9
+ class ZephyrSquadCloud(object):
10
+ """
11
+ Reference: https://zephyrsquad.docs.apiary.io//
12
+ """
13
+
14
+ def __init__(self, account_id, access_key, secret_key):
15
+ self.account_id = account_id
16
+ self.access_key = access_key
17
+ self.secret_key = secret_key
18
+ self.base_url = "https://prod-api.zephyr4jiracloud.com/connect"
19
+
20
+ def get_test_step(self, issue_id, step_id, project_id):
21
+ canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
22
+ api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
23
+ return self._do_request(method="GET", api_path=api_path, canonical_path=canonical_path)
24
+
25
+ def update_test_step(self, issue_id, step_id, project_id, json):
26
+ canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
27
+ api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
28
+ return self._do_request(method="PUT", api_path=api_path, canonical_path=canonical_path, json=json)
29
+
30
+ def delete_test_step(self, issue_id, step_id, project_id):
31
+ canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
32
+ api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
33
+ return self._do_request(method="DELETE", api_path=api_path, canonical_path=canonical_path)
34
+
35
+ def create_new_test_step(self, issue_id, project_id, json):
36
+ canonical_path = "/public/rest/api/1.0/teststep/issueId?projectId="
37
+ api_path = f"/public/rest/api/1.0/teststep/{issue_id}?projectId={project_id}"
38
+ return self._do_request(method="POST", api_path=api_path, canonical_path=canonical_path, json=json)
39
+
40
+ def get_all_test_steps(self, issue_id, project_id):
41
+ canonical_path = "/public/rest/api/2.0/teststep/issueId?projectId="
42
+ api_path = f"/public/rest/api/2.0/teststep/{issue_id}?projectId={project_id}"
43
+ return self._do_request(method='GET', api_path=api_path, canonical_path=canonical_path)
44
+
45
+ def get_all_test_step_statuses(self):
46
+ api_path = "/public/rest/api/1.0/teststep/statuses"
47
+ return self._do_request(method='GET', api_path=api_path)
48
+
49
+ def _do_request(self, method, api_path, canonical_path=None, json=None):
50
+ url = f"{self.base_url}{api_path}"
51
+ headers = {
52
+ "Authorization": f"JWT {self._generate_jwt_token(method, canonical_path or api_path)}",
53
+ "zapiAccessKey": self.access_key,
54
+ "Content-Type": "application/json"
55
+ }
56
+
57
+ try:
58
+ resp = requests.request(method=method, url=url, json=json, headers=headers)
59
+
60
+ if resp.ok:
61
+ if resp.headers.get("Content-Type", "").startswith("application/json"):
62
+ return str(resp.json())
63
+ else:
64
+ return resp.text
65
+ else:
66
+ raise ToolException(f"Request failed with status {resp.status_code}: {resp.text}")
67
+ except Exception as e:
68
+ raise ToolException(f"Error performing request {method}:{api_path}: {e}")
69
+
70
+ def _generate_jwt_token(self, method, path):
71
+ canonical_path = f"{method}&{path}&"
72
+ payload_token = {
73
+ 'sub': self.account_id,
74
+ 'qsh': hashlib.sha256(canonical_path.encode('utf-8')).hexdigest(),
75
+ 'iss': self.access_key,
76
+ 'exp': int(time.time()) + 3600,
77
+ 'iat': int(time.time())
78
+ }
79
+ return jwt.encode(payload_token, self.secret_key, algorithm='HS256').strip()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.161
3
+ Version: 0.3.163
4
4
  Summary: SDK for building langchain agents using resources from Alita
5
5
  Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -129,7 +129,7 @@ alita_sdk/runtime/utils/logging.py,sha256=svPyiW8ztDfhqHFITv5FBCj8UhLxz6hWcqGIY6
129
129
  alita_sdk/runtime/utils/save_dataframe.py,sha256=i-E1wp-t4wb17Zq3nA3xYwgSILjoXNizaQAA9opWvxY,1576
130
130
  alita_sdk/runtime/utils/streamlit.py,sha256=z4J_bdxkA0zMROkvTB4u379YBRFCkKh-h7PD8RlnZWQ,85644
131
131
  alita_sdk/runtime/utils/utils.py,sha256=dM8whOJAuFJFe19qJ69-FLzrUp6d2G-G6L7d4ss2XqM,346
132
- alita_sdk/tools/__init__.py,sha256=qsF21SiBa7P5gcWybCLP4K3xqA34LW9TVuM1QKaU-xc,9716
132
+ alita_sdk/tools/__init__.py,sha256=Ttjp6AVkjuh-WqGE_cc_nUwi4qvU1khf7_BVKdwO7gU,9801
133
133
  alita_sdk/tools/elitea_base.py,sha256=NQaIxPX6DVIerHCb18jwUR6maZxxk73NZaTsFHkBQWE,21119
134
134
  alita_sdk/tools/ado/__init__.py,sha256=mD6GHcYMTtffPJkJvFPe2rzvye_IRmXmWfI7xYuZhO4,912
135
135
  alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
@@ -160,14 +160,20 @@ alita_sdk/tools/browser/google_search_rag.py,sha256=QVHFbVwymiJGuno_HLSJOK1c_Mpg
160
160
  alita_sdk/tools/browser/utils.py,sha256=4k3YM_f1Kqlhjz9vt2pNsGkvCjhy-EmY3nvcwdFCsLA,2501
161
161
  alita_sdk/tools/browser/wiki.py,sha256=Qh3HBFd4dkS2VavXbFJOm4b8SjVSIe5xSD7CY1vEkKE,1126
162
162
  alita_sdk/tools/carrier/__init__.py,sha256=pP-nk-dpqOkrvwcRY_szgwqoowyVNl_GobD4Inp-Qus,4435
163
- alita_sdk/tools/carrier/api_wrapper.py,sha256=Ns0lGbtGKRGBTdOWseWtz4heyY3hP4AcnB9QEx_d5JU,5344
163
+ alita_sdk/tools/carrier/api_wrapper.py,sha256=smcc1Q7H6U1_18qDYBFpeGnu5cX3OrsUoKaSn3s6vkw,8728
164
164
  alita_sdk/tools/carrier/backend_reports_tool.py,sha256=WNZVGBIZusakOdbd7lG6o6xL180VZfER-uDw_SSGupo,11005
165
165
  alita_sdk/tools/carrier/backend_tests_tool.py,sha256=arq275qiP9t3ST-MPn7FlxbLLSPiIGEnyPdgJ-AvOoQ,5917
166
- alita_sdk/tools/carrier/carrier_sdk.py,sha256=1QXbO3BrIYaZFd30GZzATXw9Wfh8ga7CfmUihD9ueks,9709
166
+ alita_sdk/tools/carrier/cancel_ui_test_tool.py,sha256=pD1sKEcZGBWJqFpgjeohMk93uuUPWruVJRPVVg90rpo,6438
167
+ alita_sdk/tools/carrier/carrier_sdk.py,sha256=sYdPWcpH8ti0MggOvU2pbsKYiaKR1zuXlbiCtcTfc3A,12913
168
+ alita_sdk/tools/carrier/create_ui_excel_report_tool.py,sha256=sYAz54ILk8CIF_n76zH_hcmbW9xw7oTNnf_d9d-N-_Q,20171
169
+ alita_sdk/tools/carrier/create_ui_test_tool.py,sha256=sHi7-D1uqIUHEyoywI92h6MdUVybKfBXs_XttTu-Ck4,8624
167
170
  alita_sdk/tools/carrier/excel_reporter.py,sha256=fXptz7iaBDBcFSc8Ah8nZ9CSgugTONc5JMC1XcQEnfM,21487
171
+ alita_sdk/tools/carrier/lighthouse_excel_reporter.py,sha256=mVuU63tl2n-Gntx9RuedjEU0U5AP1APKsSx1DvJs7wk,6684
172
+ alita_sdk/tools/carrier/run_ui_test_tool.py,sha256=vmEtP-cpnOCyLLZfbw9Nq2ItGUFlcnsf1LmI_XyLrM8,21053
168
173
  alita_sdk/tools/carrier/tickets_tool.py,sha256=d-wFyFWWTvV01o-hyssb2S-oLnr51b6tlNTUqA_CohY,8099
169
- alita_sdk/tools/carrier/tools.py,sha256=GeV5KtB3kfMygQ9y-z2Mgk2x0A2pg0SRoZkev3Dqx-M,996
170
- alita_sdk/tools/carrier/ui_reports_tool.py,sha256=haOZuGWYsLg2rj_dO1zaPpUmj77Rxjs8e4LyTaqeV1E,13525
174
+ alita_sdk/tools/carrier/tools.py,sha256=cCLYcNzC_z0-AaqB46fyt7iOeP20LStVQKI5Dg1zWA4,1588
175
+ alita_sdk/tools/carrier/ui_reports_tool.py,sha256=Y6EstTRCa9d11ipFUFGOYlpiEhFx7aOQcgZ_M5Gd1lQ,13708
176
+ alita_sdk/tools/carrier/update_ui_test_schedule_tool.py,sha256=jh9Q86cMCEqpsFopJPNIP0wlr7sYVa_3lhlq6lRmkGg,11850
171
177
  alita_sdk/tools/carrier/utils.py,sha256=rl7aq-F6ed_PapDM15w8EtS0BkgsjpDrNdKYuDCMOaI,4376
172
178
  alita_sdk/tools/chunkers/__init__.py,sha256=myaBVvPbUsz6PXtBDpA4EiPQgLvIv3q_WPh86kxlccI,774
173
179
  alita_sdk/tools/chunkers/models.py,sha256=NNkLSljZboYDj6vbqeHmcjj9JrTHbkVWmoHGsL98q3k,3032
@@ -220,11 +226,11 @@ alita_sdk/tools/elastic/__init__.py,sha256=iwnSRppRpzvJ1da2K3Glu8Uu41MhBDCYbgubo
220
226
  alita_sdk/tools/elastic/api_wrapper.py,sha256=pl8CqQxteJAGwyOhMcld-ZgtOTFwwbv42OITQVe8rM0,1948
221
227
  alita_sdk/tools/figma/__init__.py,sha256=rtEebf9zj1zUD0bpkN-SupaYpjmHFM01gY8XZNE9TI0,4088
222
228
  alita_sdk/tools/figma/api_wrapper.py,sha256=G96pEp_qUOouwkM5xMqRg-Ywfx_kEey8NV8iO7YLodE,17190
223
- alita_sdk/tools/github/__init__.py,sha256=s-ejtyNXjQ3Wo-QhLMJkOSab-qY5ZJC6V_df0GuS3ro,6337
224
- alita_sdk/tools/github/api_wrapper.py,sha256=-98miPAF_JQMIEDT3g8KS6QJ7bHMUSlj4s38zXyFJ2M,8281
225
- alita_sdk/tools/github/github_client.py,sha256=bzVXim8U-QH6RzlkAzIUiTrhD4MDi3Xs4pKxVdghvhc,79465
229
+ alita_sdk/tools/github/__init__.py,sha256=YPpZPPhRUHWKJ9aaMJnkjl9xrnAij1YB9C2TMRnlaTI,6388
230
+ alita_sdk/tools/github/api_wrapper.py,sha256=qyIrwPg07TFsTB1l95soy1xsJIuxfKOWTWUdLZCmTA4,8365
231
+ alita_sdk/tools/github/github_client.py,sha256=YKhLDMq0VF1KM_Get2JKj-YsipwozeSX8xdcCaM4XvI,85395
226
232
  alita_sdk/tools/github/graphql_client_wrapper.py,sha256=d3AGjzLGH_hdQV2V8HeAX92dJ4dlnE5OXqUlCO_PBr0,71539
227
- alita_sdk/tools/github/schemas.py,sha256=6BAzeGaXkyS-rde2gJDi3xqic161de1PBh-CrlOgK_4,12826
233
+ alita_sdk/tools/github/schemas.py,sha256=9JfJ3nYdFeT30dOwZH6QZyZYMT8v8HrKq1jOv6Xn-Gs,13739
228
234
  alita_sdk/tools/github/tool.py,sha256=Jnnv5lenV5ds8AAdyo2m8hSzyJ117HZBjzHC6T1ck-M,1037
229
235
  alita_sdk/tools/github/tool_prompts.py,sha256=y6ZW_FpUCE87Uop3WuQAZVRnzxO5t7xjBOI5bCqiluw,30194
230
236
  alita_sdk/tools/gitlab/__init__.py,sha256=_nbp3tJviTZxfewyV3Hp9-TK1vCxTmqlxhpwv0f_x4Y,3602
@@ -317,8 +323,11 @@ alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=Ir3zHljhbZQJRJJQOBzS_GL5
317
323
  alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
318
324
  alita_sdk/tools/zephyr_scale/__init__.py,sha256=2NTcdrfkx4GSegqyXhsPLsEpc4FlACuDy85b0fk6cAo,4572
319
325
  alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw2cCDQa-xMOzndE,68663
320
- alita_sdk-0.3.161.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
321
- alita_sdk-0.3.161.dist-info/METADATA,sha256=ybWYeKeLOJiQcnasyPl7i0jE6OTcqEmuVfmid62TT3A,18667
322
- alita_sdk-0.3.161.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
323
- alita_sdk-0.3.161.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
324
- alita_sdk-0.3.161.dist-info/RECORD,,
326
+ alita_sdk/tools/zephyr_squad/__init__.py,sha256=rq4jOb3lRW2GXvAguk4H1KinO5f-zpygzhBJf-E1Ucw,2773
327
+ alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=iOMxyE7vOc_LwFB_nBMiSFXkNtvbptA4i-BrTlo7M0A,5854
328
+ alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=IYUJoMFOMA70knLhLtAnuGoy3OK80RuqeQZ710oyIxE,3631
329
+ alita_sdk-0.3.163.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
330
+ alita_sdk-0.3.163.dist-info/METADATA,sha256=3Fd8T3ods52lKrlnTjGDxEAn_svB00x64xg65cCi8rY,18667
331
+ alita_sdk-0.3.163.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
332
+ alita_sdk-0.3.163.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
333
+ alita_sdk-0.3.163.dist-info/RECORD,,