testit-python-commons 3.9.1.post540__tar.gz → 3.10.1.post550__tar.gz
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.
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/PKG-INFO +2 -2
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/setup.py +2 -2
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/api_client.py +58 -34
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/converter.py +46 -26
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/adapter_manager.py +1 -1
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/step.py +3 -3
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
- testit_python_commons-3.10.1.post550/src/testit_python_commons.egg-info/requires.txt +3 -0
- testit_python_commons-3.9.1.post540/src/testit_python_commons.egg-info/requires.txt +0 -3
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/README.md +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/setup.cfg +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/app_properties.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/client_configuration.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/helpers/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/helpers/bulk_autotest_helper.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/helpers/threads_manager.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/models/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/models/threads_for_create_and_result.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/client/models/threads_for_update_and_result.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/decorators.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/dynamic_methods.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/adapter_mode.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/fixture.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/link.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/link_type.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/outcome_type.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/step_result.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/test_result.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/fixture_manager.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/fixture_storage.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/logger.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/plugin_manager.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/retry.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/step_manager.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/step_result_storage.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/services/utils.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/utils/__init__.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons/utils/html_escape_utils.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/src/testit_python_commons.egg-info/top_level.txt +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/tests/test_app_properties.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/tests/test_dynamic_methods.py +0 -0
- {testit_python_commons-3.9.1.post540 → testit_python_commons-3.10.1.post550}/tests/test_html_escape_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.10.1.post550
|
|
4
4
|
Summary: Python commons for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
Requires-Dist: pluggy
|
|
19
19
|
Requires-Dist: tomli
|
|
20
|
-
Requires-Dist: testit-api-client==7.0.
|
|
20
|
+
Requires-Dist: testit-api-client==7.2.0.post550
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from setuptools import find_packages, setup
|
|
2
2
|
|
|
3
|
-
VERSION = "3.
|
|
3
|
+
VERSION = "3.10.1.post550"
|
|
4
4
|
|
|
5
5
|
setup(
|
|
6
6
|
name='testit-python-commons',
|
|
@@ -25,5 +25,5 @@ setup(
|
|
|
25
25
|
py_modules=['testit', 'testit_python_commons'],
|
|
26
26
|
packages=find_packages(where='src'),
|
|
27
27
|
package_dir={'': 'src'},
|
|
28
|
-
install_requires=['pluggy', 'tomli', 'testit-api-client==7.0.
|
|
28
|
+
install_requires=['pluggy', 'tomli', 'testit-api-client==7.2.0.post550']
|
|
29
29
|
)
|
|
@@ -5,12 +5,14 @@ from datetime import datetime
|
|
|
5
5
|
from testit_api_client import ApiClient, Configuration
|
|
6
6
|
from testit_api_client.apis import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi, WorkItemsApi
|
|
7
7
|
from testit_api_client.models import (
|
|
8
|
+
ApiV2TestResultsSearchPostRequest,
|
|
8
9
|
AutoTestApiResult,
|
|
9
10
|
AutoTestPostModel,
|
|
10
11
|
AutoTestPutModel,
|
|
11
12
|
AttachmentPutModel,
|
|
12
|
-
|
|
13
|
+
ApiV2AutoTestsSearchPostRequest,
|
|
13
14
|
TestResultResponse,
|
|
15
|
+
TestResultShortResponse,
|
|
14
16
|
LinkAutoTestToWorkItemRequest,
|
|
15
17
|
WorkItemIdentifierModel
|
|
16
18
|
)
|
|
@@ -22,11 +24,11 @@ from testit_python_commons.models.test_result import TestResult
|
|
|
22
24
|
from testit_python_commons.services.logger import adapter_logger
|
|
23
25
|
from testit_python_commons.services.retry import retry
|
|
24
26
|
from testit_python_commons.utils.html_escape_utils import HtmlEscapeUtils
|
|
25
|
-
from typing import List
|
|
27
|
+
from typing import List, Any
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
class ApiClientWorker:
|
|
29
|
-
|
|
31
|
+
__tests_limit = 100
|
|
30
32
|
|
|
31
33
|
def __init__(self, config: ClientConfiguration):
|
|
32
34
|
api_client_config = self.__get_api_client_configuration(
|
|
@@ -60,12 +62,12 @@ class ApiClientWorker:
|
|
|
60
62
|
header_value='PrivateToken ' + token)
|
|
61
63
|
|
|
62
64
|
@staticmethod
|
|
63
|
-
def _escape_html_in_model(model):
|
|
65
|
+
def _escape_html_in_model(model: Any) -> Any:
|
|
64
66
|
"""Apply HTML escaping to all models before sending to API"""
|
|
65
67
|
return HtmlEscapeUtils.escape_html_in_object(model)
|
|
66
68
|
|
|
67
69
|
@adapter_logger
|
|
68
|
-
def create_test_run(self):
|
|
70
|
+
def create_test_run(self) -> str:
|
|
69
71
|
test_run_name = f'TestRun_{datetime.today().strftime("%Y-%m-%dT%H:%M:%S")}' if \
|
|
70
72
|
not self.__config.get_test_run_name() else self.__config.get_test_run_name()
|
|
71
73
|
model = Converter.test_run_to_test_run_short_model(
|
|
@@ -79,19 +81,50 @@ class ApiClientWorker:
|
|
|
79
81
|
return Converter.get_id_from_create_test_run_response(response)
|
|
80
82
|
|
|
81
83
|
@adapter_logger
|
|
82
|
-
def set_test_run_id(self, test_run_id: str):
|
|
84
|
+
def set_test_run_id(self, test_run_id: str) -> None:
|
|
83
85
|
self.__config.set_test_run_id(test_run_id)
|
|
84
86
|
|
|
85
87
|
@adapter_logger
|
|
86
|
-
def
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
response,
|
|
88
|
+
def get_external_ids_for_test_run_id(self) -> List[str]:
|
|
89
|
+
test_results: List[TestResultShortResponse] = self.__get_test_results()
|
|
90
|
+
external_ids: List[str] = Converter.get_external_ids_from_autotest_response_list(
|
|
91
|
+
test_results,
|
|
91
92
|
self.__config.get_configuration_id())
|
|
92
93
|
|
|
94
|
+
if len(external_ids) > 0:
|
|
95
|
+
return external_ids
|
|
96
|
+
|
|
97
|
+
raise Exception('The autotests with the status "InProgress" ' +
|
|
98
|
+
f'and the configuration id "{self.__config.get_configuration_id()}" were not found!')
|
|
99
|
+
|
|
100
|
+
def __get_test_results(self) -> List[TestResultShortResponse]:
|
|
101
|
+
all_test_results = []
|
|
102
|
+
skip = 0
|
|
103
|
+
model: ApiV2TestResultsSearchPostRequest = (
|
|
104
|
+
Converter.build_test_results_search_post_request_with_in_progress_outcome(
|
|
105
|
+
self.__config.get_test_run_id(),
|
|
106
|
+
self.__config.get_configuration_id()))
|
|
107
|
+
|
|
108
|
+
while skip >= 0:
|
|
109
|
+
logging.debug(f"Getting test results with limit {self.__tests_limit}: {model}")
|
|
110
|
+
|
|
111
|
+
test_results: List[TestResultShortResponse] = self.__test_results_api.api_v2_test_results_search_post(
|
|
112
|
+
skip=skip,
|
|
113
|
+
take=self.__tests_limit,
|
|
114
|
+
api_v2_test_results_search_post_request=model)
|
|
115
|
+
|
|
116
|
+
logging.debug(f"Got {len(test_results)} test results: {test_results}")
|
|
117
|
+
|
|
118
|
+
all_test_results.extend(test_results)
|
|
119
|
+
skip += self.__tests_limit
|
|
120
|
+
|
|
121
|
+
if len(test_results) == 0:
|
|
122
|
+
skip = -1
|
|
123
|
+
|
|
124
|
+
return all_test_results
|
|
125
|
+
|
|
93
126
|
@adapter_logger
|
|
94
|
-
def __get_autotests_by_external_id(self, external_id: str) ->
|
|
127
|
+
def __get_autotests_by_external_id(self, external_id: str) -> List[AutoTestApiResult]:
|
|
95
128
|
model = Converter.project_id_and_external_id_to_auto_tests_search_post_request(
|
|
96
129
|
self.__config.get_project_id(),
|
|
97
130
|
external_id)
|
|
@@ -99,7 +132,7 @@ class ApiClientWorker:
|
|
|
99
132
|
return self.__autotest_api.api_v2_auto_tests_search_post(api_v2_auto_tests_search_post_request=model)
|
|
100
133
|
|
|
101
134
|
@adapter_logger
|
|
102
|
-
def write_test(self, test_result: TestResult):
|
|
135
|
+
def write_test(self, test_result: TestResult) -> str:
|
|
103
136
|
model = Converter.project_id_and_external_id_to_auto_tests_search_post_request(
|
|
104
137
|
self.__config.get_project_id(),
|
|
105
138
|
test_result.get_external_id())
|
|
@@ -118,7 +151,7 @@ class ApiClientWorker:
|
|
|
118
151
|
return self.__load_test_result(test_result)
|
|
119
152
|
|
|
120
153
|
@adapter_logger
|
|
121
|
-
def write_tests(self, test_results: List[TestResult], fixture_containers: dict):
|
|
154
|
+
def write_tests(self, test_results: List[TestResult], fixture_containers: dict) -> None:
|
|
122
155
|
bulk_autotest_helper = BulkAutotestHelper(self.__autotest_api, self.__test_run_api, self.__config)
|
|
123
156
|
|
|
124
157
|
for test_result in test_results:
|
|
@@ -181,8 +214,8 @@ class ApiClientWorker:
|
|
|
181
214
|
@adapter_logger
|
|
182
215
|
def __get_work_item_uuids_for_link_with_auto_test(
|
|
183
216
|
self,
|
|
184
|
-
work_item_ids:
|
|
185
|
-
autotest_global_id: str = None) ->
|
|
217
|
+
work_item_ids: List[str],
|
|
218
|
+
autotest_global_id: str = None) -> List[str]:
|
|
186
219
|
linked_work_items = []
|
|
187
220
|
|
|
188
221
|
if autotest_global_id:
|
|
@@ -195,8 +228,8 @@ class ApiClientWorker:
|
|
|
195
228
|
@adapter_logger
|
|
196
229
|
def __prepare_list_of_work_item_uuids(
|
|
197
230
|
self,
|
|
198
|
-
linked_work_items:
|
|
199
|
-
work_item_ids:
|
|
231
|
+
linked_work_items: List[WorkItemIdentifierModel],
|
|
232
|
+
work_item_ids: List[str]) -> List[str]:
|
|
200
233
|
work_item_uuids = []
|
|
201
234
|
|
|
202
235
|
for linked_work_item in linked_work_items:
|
|
@@ -275,7 +308,7 @@ class ApiClientWorker:
|
|
|
275
308
|
return autotest_response.id
|
|
276
309
|
|
|
277
310
|
@adapter_logger
|
|
278
|
-
def __create_tests(self, autotests_for_create: List[AutoTestPostModel]):
|
|
311
|
+
def __create_tests(self, autotests_for_create: List[AutoTestPostModel]) -> None:
|
|
279
312
|
logging.debug(f'Creating autotests: "{autotests_for_create}')
|
|
280
313
|
|
|
281
314
|
autotests_for_create = self._escape_html_in_model(autotests_for_create)
|
|
@@ -284,7 +317,7 @@ class ApiClientWorker:
|
|
|
284
317
|
logging.debug(f'Autotests were created')
|
|
285
318
|
|
|
286
319
|
@adapter_logger
|
|
287
|
-
def __update_test(self, test_result: TestResult, autotest: AutoTestApiResult):
|
|
320
|
+
def __update_test(self, test_result: TestResult, autotest: AutoTestApiResult) -> None:
|
|
288
321
|
logging.debug(f'Autotest "{test_result.get_autotest_name()}" was found')
|
|
289
322
|
|
|
290
323
|
model = Converter.prepare_to_update_autotest(test_result, autotest, self.__config.get_project_id())
|
|
@@ -298,7 +331,7 @@ class ApiClientWorker:
|
|
|
298
331
|
logging.debug(f'Autotest "{test_result.get_autotest_name()}" was updated')
|
|
299
332
|
|
|
300
333
|
@adapter_logger
|
|
301
|
-
def __update_tests(self, autotests_for_update: List[AutoTestPutModel]):
|
|
334
|
+
def __update_tests(self, autotests_for_update: List[AutoTestPutModel]) -> None:
|
|
302
335
|
logging.debug(f'Updating autotests: {autotests_for_update}')
|
|
303
336
|
|
|
304
337
|
autotests_for_update = self._escape_html_in_model(autotests_for_update)
|
|
@@ -308,7 +341,7 @@ class ApiClientWorker:
|
|
|
308
341
|
|
|
309
342
|
@adapter_logger
|
|
310
343
|
@retry
|
|
311
|
-
def __unlink_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
344
|
+
def __unlink_test_to_work_item(self, autotest_global_id: str, work_item_id: str) -> None:
|
|
312
345
|
self.__autotest_api.delete_auto_test_link_from_work_item(
|
|
313
346
|
id=autotest_global_id,
|
|
314
347
|
work_item_id=work_item_id)
|
|
@@ -317,7 +350,7 @@ class ApiClientWorker:
|
|
|
317
350
|
|
|
318
351
|
@adapter_logger
|
|
319
352
|
@retry
|
|
320
|
-
def __link_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
353
|
+
def __link_test_to_work_item(self, autotest_global_id: str, work_item_id: str) -> None:
|
|
321
354
|
self.__autotest_api.link_auto_test_to_work_item(
|
|
322
355
|
autotest_global_id,
|
|
323
356
|
link_auto_test_to_work_item_request=LinkAutoTestToWorkItemRequest(id=work_item_id))
|
|
@@ -340,21 +373,12 @@ class ApiClientWorker:
|
|
|
340
373
|
|
|
341
374
|
return Converter.get_test_result_id_from_testrun_result_post_response(response)
|
|
342
375
|
|
|
343
|
-
@adapter_logger
|
|
344
|
-
def __load_test_results(self, test_results: List[AutoTestResultsForTestRunModel]):
|
|
345
|
-
logging.debug(f'Loading test results: {test_results}')
|
|
346
|
-
|
|
347
|
-
test_results = self._escape_html_in_model(test_results)
|
|
348
|
-
self.__test_run_api.set_auto_test_results_for_test_run(
|
|
349
|
-
id=self.__config.get_test_run_id(),
|
|
350
|
-
auto_test_results_for_test_run_model=test_results)
|
|
351
|
-
|
|
352
376
|
@adapter_logger
|
|
353
377
|
def get_test_result_by_id(self, test_result_id: str) -> TestResultResponse:
|
|
354
378
|
return self.__test_results_api.api_v2_test_results_id_get(id=test_result_id)
|
|
355
379
|
|
|
356
380
|
@adapter_logger
|
|
357
|
-
def update_test_results(self, fixtures_containers: dict, test_result_ids: dict):
|
|
381
|
+
def update_test_results(self, fixtures_containers: dict, test_result_ids: dict) -> None:
|
|
358
382
|
test_results = Converter.fixtures_containers_to_test_results_with_all_fixture_step_results(
|
|
359
383
|
fixtures_containers, test_result_ids)
|
|
360
384
|
|
|
@@ -377,7 +401,7 @@ class ApiClientWorker:
|
|
|
377
401
|
logging.error(f'Cannot update test result with id "{test_result.get_test_result_id()}" status: {exc}')
|
|
378
402
|
|
|
379
403
|
@adapter_logger
|
|
380
|
-
def load_attachments(self, attach_paths: list or tuple):
|
|
404
|
+
def load_attachments(self, attach_paths: list or tuple) -> List[AttachmentPutModel]:
|
|
381
405
|
attachments = []
|
|
382
406
|
|
|
383
407
|
for path in attach_paths:
|
|
@@ -2,6 +2,7 @@ import logging
|
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
4
|
from testit_api_client.models import (
|
|
5
|
+
ApiV2TestResultsSearchPostRequest,
|
|
5
6
|
AutoTestApiResult,
|
|
6
7
|
AttachmentPutModelAutoTestStepResultsModel,
|
|
7
8
|
AutoTestStepResultUpdateRequest,
|
|
@@ -17,12 +18,12 @@ from testit_api_client.models import (
|
|
|
17
18
|
LinkType,
|
|
18
19
|
CreateEmptyRequest,
|
|
19
20
|
TestRunV2ApiResult,
|
|
21
|
+
TestResultShortResponse,
|
|
20
22
|
AutoTestSearchApiModelFilter,
|
|
21
23
|
AutoTestSearchApiModelIncludes,
|
|
22
24
|
ApiV2AutoTestsSearchPostRequest,
|
|
23
25
|
ApiV2TestResultsIdPutRequest,
|
|
24
26
|
TestResultResponse,
|
|
25
|
-
TestResultV2GetModel,
|
|
26
27
|
AttachmentApiResult,
|
|
27
28
|
AttachmentUpdateRequest
|
|
28
29
|
)
|
|
@@ -35,29 +36,25 @@ from testit_python_commons.services.logger import adapter_logger
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
class Converter:
|
|
38
|
-
@
|
|
39
|
+
@staticmethod
|
|
39
40
|
@adapter_logger
|
|
40
|
-
def test_run_to_test_run_short_model(
|
|
41
|
+
def test_run_to_test_run_short_model(project_id: str, name: str) -> CreateEmptyRequest:
|
|
41
42
|
return CreateEmptyRequest(
|
|
42
43
|
project_id=project_id,
|
|
43
44
|
name=name
|
|
44
45
|
)
|
|
45
46
|
|
|
46
|
-
@
|
|
47
|
+
@staticmethod
|
|
47
48
|
@adapter_logger
|
|
48
|
-
def get_id_from_create_test_run_response(
|
|
49
|
+
def get_id_from_create_test_run_response(response: TestRunV2ApiResult) -> str:
|
|
49
50
|
return response.id
|
|
50
51
|
|
|
51
|
-
@
|
|
52
|
-
@adapter_logger
|
|
53
|
-
def get_resolved_autotests_from_get_test_run_response(cls, response: TestRunV2ApiResult, configuration: str):
|
|
54
|
-
autotests = response.test_results
|
|
55
|
-
|
|
56
|
-
return cls.__get_resolved_autotests(autotests, configuration)
|
|
57
|
-
|
|
58
|
-
@classmethod
|
|
52
|
+
@staticmethod
|
|
59
53
|
@adapter_logger
|
|
60
|
-
def project_id_and_external_id_to_auto_tests_search_post_request(
|
|
54
|
+
def project_id_and_external_id_to_auto_tests_search_post_request(
|
|
55
|
+
project_id: str,
|
|
56
|
+
external_id: str
|
|
57
|
+
) -> ApiV2AutoTestsSearchPostRequest:
|
|
61
58
|
autotests_filter = AutoTestSearchApiModelFilter(
|
|
62
59
|
project_ids=[project_id],
|
|
63
60
|
external_ids=[external_id],
|
|
@@ -69,23 +66,46 @@ class Converter:
|
|
|
69
66
|
|
|
70
67
|
return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
|
|
71
68
|
|
|
69
|
+
@staticmethod
|
|
70
|
+
def build_test_results_search_post_request_with_in_progress_outcome(
|
|
71
|
+
testrun_id: str,
|
|
72
|
+
configuration_id: str) -> ApiV2TestResultsSearchPostRequest:
|
|
73
|
+
return ApiV2TestResultsSearchPostRequest(
|
|
74
|
+
test_run_ids=[testrun_id],
|
|
75
|
+
configuration_ids=[configuration_id],
|
|
76
|
+
status_codes=["InProgress"])
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def autotest_ids_to_autotests_search_post_request(
|
|
80
|
+
autotest_ids: List[int]) -> ApiV2AutoTestsSearchPostRequest:
|
|
81
|
+
autotests_filter = AutoTestSearchApiModelFilter(
|
|
82
|
+
global_ids=autotest_ids)
|
|
83
|
+
autotests_includes = AutoTestSearchApiModelIncludes(
|
|
84
|
+
include_steps=False,
|
|
85
|
+
include_links=False,
|
|
86
|
+
include_labels=False)
|
|
87
|
+
|
|
88
|
+
return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
|
|
89
|
+
|
|
72
90
|
@staticmethod
|
|
73
91
|
@adapter_logger
|
|
74
|
-
def
|
|
75
|
-
|
|
92
|
+
def get_external_ids_from_autotest_response_list(
|
|
93
|
+
autotests: List[TestResultShortResponse],
|
|
94
|
+
configuration: str) -> List[str]:
|
|
95
|
+
external_ids: List[str] = []
|
|
76
96
|
|
|
77
97
|
for autotest in autotests:
|
|
78
98
|
if configuration == autotest.configuration_id:
|
|
79
|
-
|
|
99
|
+
external_ids.append(autotest.autotest_external_id)
|
|
80
100
|
|
|
81
|
-
return
|
|
101
|
+
return external_ids
|
|
82
102
|
|
|
83
103
|
@classmethod
|
|
84
104
|
@adapter_logger
|
|
85
105
|
def test_result_to_autotest_post_model(
|
|
86
106
|
cls,
|
|
87
107
|
test_result: TestResult,
|
|
88
|
-
project_id: str):
|
|
108
|
+
project_id: str) -> AutoTestPostModel:
|
|
89
109
|
return AutoTestPostModel(
|
|
90
110
|
external_id=test_result.get_external_id(),
|
|
91
111
|
project_id=project_id,
|
|
@@ -111,7 +131,7 @@ class Converter:
|
|
|
111
131
|
def test_result_to_create_autotest_request(
|
|
112
132
|
cls,
|
|
113
133
|
test_result: TestResult,
|
|
114
|
-
project_id: str):
|
|
134
|
+
project_id: str) -> CreateAutoTestRequest:
|
|
115
135
|
return CreateAutoTestRequest(
|
|
116
136
|
external_id=test_result.get_external_id(),
|
|
117
137
|
project_id=project_id,
|
|
@@ -137,7 +157,7 @@ class Converter:
|
|
|
137
157
|
def test_result_to_autotest_put_model(
|
|
138
158
|
cls,
|
|
139
159
|
test_result: TestResult,
|
|
140
|
-
project_id: str):
|
|
160
|
+
project_id: str) -> AutoTestPutModel:
|
|
141
161
|
if test_result.get_outcome() == 'Passed':
|
|
142
162
|
return AutoTestPutModel(
|
|
143
163
|
external_id=test_result.get_external_id(),
|
|
@@ -182,7 +202,7 @@ class Converter:
|
|
|
182
202
|
def test_result_to_update_autotest_request(
|
|
183
203
|
cls,
|
|
184
204
|
test_result: TestResult,
|
|
185
|
-
project_id: str):
|
|
205
|
+
project_id: str) -> UpdateAutoTestRequest:
|
|
186
206
|
if test_result.get_outcome() == 'Passed':
|
|
187
207
|
return UpdateAutoTestRequest(
|
|
188
208
|
external_id=test_result.get_external_id(),
|
|
@@ -227,11 +247,11 @@ class Converter:
|
|
|
227
247
|
def test_result_to_testrun_result_post_model(
|
|
228
248
|
cls,
|
|
229
249
|
test_result: TestResult,
|
|
230
|
-
configuration_id: str):
|
|
250
|
+
configuration_id: str) -> AutoTestResultsForTestRunModel:
|
|
231
251
|
return AutoTestResultsForTestRunModel(
|
|
232
252
|
configuration_id=configuration_id,
|
|
233
253
|
auto_test_external_id=test_result.get_external_id(),
|
|
234
|
-
|
|
254
|
+
status_code=test_result.get_outcome(),
|
|
235
255
|
step_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
|
|
236
256
|
test_result.get_step_results()),
|
|
237
257
|
setup_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
|
|
@@ -257,7 +277,7 @@ class Converter:
|
|
|
257
277
|
test_result: TestResultResponse) -> ApiV2TestResultsIdPutRequest:
|
|
258
278
|
return ApiV2TestResultsIdPutRequest(
|
|
259
279
|
failure_class_ids=test_result.failure_class_ids,
|
|
260
|
-
|
|
280
|
+
status_code=test_result.status.code,
|
|
261
281
|
comment=test_result.comment,
|
|
262
282
|
links=test_result.links,
|
|
263
283
|
step_results=test_result.step_results,
|
|
@@ -459,7 +479,7 @@ class Converter:
|
|
|
459
479
|
cls,
|
|
460
480
|
test_result: TestResult,
|
|
461
481
|
project_id: str,
|
|
462
|
-
work_item_ids_for_link_with_auto_test: list) ->
|
|
482
|
+
work_item_ids_for_link_with_auto_test: list) -> CreateAutoTestRequest:
|
|
463
483
|
logging.debug('Preparing to create the auto test ' + test_result.get_external_id())
|
|
464
484
|
|
|
465
485
|
model = cls.test_result_to_create_autotest_request(
|
|
@@ -38,7 +38,7 @@ class AdapterManager:
|
|
|
38
38
|
@adapter_logger
|
|
39
39
|
def get_autotests_for_launch(self):
|
|
40
40
|
if self.__config.get_mode() == AdapterMode.USE_FILTER:
|
|
41
|
-
return self.__api_client.
|
|
41
|
+
return self.__api_client.get_external_ids_for_test_run_id()
|
|
42
42
|
|
|
43
43
|
return
|
|
44
44
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import datetime
|
|
1
|
+
from datetime import datetime, UTC
|
|
2
2
|
import logging
|
|
3
3
|
from functools import wraps
|
|
4
4
|
from typing import Any, Callable, TypeVar
|
|
@@ -52,7 +52,7 @@ class StepContext:
|
|
|
52
52
|
self.__parameters = parameters
|
|
53
53
|
|
|
54
54
|
def __enter__(self):
|
|
55
|
-
self.__start_time = round(datetime.
|
|
55
|
+
self.__start_time = round(datetime.now(UTC).timestamp() * 1000)
|
|
56
56
|
self.__step_result = StepResult()
|
|
57
57
|
|
|
58
58
|
self.__title = Utils.collect_parameters_in_string_attribute(self.__title, self.__parameters)
|
|
@@ -74,7 +74,7 @@ class StepContext:
|
|
|
74
74
|
else TmsPluginManager.get_plugin_manager().hook.get_pytest_check_outcome()[0] if \
|
|
75
75
|
hasattr(TmsPluginManager.get_plugin_manager().hook, 'get_pytest_check_outcome') \
|
|
76
76
|
else 'Passed'
|
|
77
|
-
duration = round(datetime.
|
|
77
|
+
duration = round(datetime.now(UTC).timestamp() * 1000) - self.__start_time
|
|
78
78
|
|
|
79
79
|
self.__step_result\
|
|
80
80
|
.set_outcome(outcome)\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.10.1.post550
|
|
4
4
|
Summary: Python commons for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
Requires-Dist: pluggy
|
|
19
19
|
Requires-Dist: tomli
|
|
20
|
-
Requires-Dist: testit-api-client==7.0.
|
|
20
|
+
Requires-Dist: testit-api-client==7.2.0.post550
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|