testit-python-commons 4.2.8__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.
- api_client_syncstorage/__init__.py +27 -0
- api_client_syncstorage/api/__init__.py +3 -0
- api_client_syncstorage/api/completion_api.py +302 -0
- api_client_syncstorage/api/health_api.py +158 -0
- api_client_syncstorage/api/system_api.py +158 -0
- api_client_syncstorage/api/test_results_api.py +182 -0
- api_client_syncstorage/api/workers_api.py +308 -0
- api_client_syncstorage/api_client.py +898 -0
- api_client_syncstorage/apis/__init__.py +21 -0
- api_client_syncstorage/configuration.py +450 -0
- api_client_syncstorage/exceptions.py +158 -0
- api_client_syncstorage/model/__init__.py +5 -0
- api_client_syncstorage/model/completion_response.py +267 -0
- api_client_syncstorage/model/health_status_response.py +267 -0
- api_client_syncstorage/model/register_request.py +275 -0
- api_client_syncstorage/model/register_response.py +279 -0
- api_client_syncstorage/model/set_worker_status_request.py +271 -0
- api_client_syncstorage/model/set_worker_status_response.py +267 -0
- api_client_syncstorage/model/shutdown_response.py +267 -0
- api_client_syncstorage/model/test_result_cut_api_model.py +279 -0
- api_client_syncstorage/model/test_result_save_response.py +267 -0
- api_client_syncstorage/model_utils.py +2058 -0
- api_client_syncstorage/models/__init__.py +20 -0
- api_client_syncstorage/rest.py +356 -0
- testit.py +69 -0
- testit_python_commons/__init__.py +0 -0
- testit_python_commons/app_properties.py +257 -0
- testit_python_commons/client/__init__.py +9 -0
- testit_python_commons/client/api_client.py +560 -0
- testit_python_commons/client/client_configuration.py +74 -0
- testit_python_commons/client/converter.py +618 -0
- testit_python_commons/client/helpers/__init__.py +0 -0
- testit_python_commons/client/helpers/bulk_autotest_helper.py +246 -0
- testit_python_commons/client/helpers/threads_manager.py +86 -0
- testit_python_commons/client/models/__init__.py +8 -0
- testit_python_commons/client/models/threads_for_create_and_result.py +35 -0
- testit_python_commons/client/models/threads_for_update_and_result.py +45 -0
- testit_python_commons/configurations/__init__.py +0 -0
- testit_python_commons/configurations/properties_names.py +51 -0
- testit_python_commons/decorators.py +221 -0
- testit_python_commons/dynamic_methods.py +237 -0
- testit_python_commons/models/__init__.py +5 -0
- testit_python_commons/models/adapter_mode.py +4 -0
- testit_python_commons/models/fixture.py +24 -0
- testit_python_commons/models/link.py +53 -0
- testit_python_commons/models/link_type.py +10 -0
- testit_python_commons/models/outcome_type.py +5 -0
- testit_python_commons/models/status_type.py +6 -0
- testit_python_commons/models/step_result.py +90 -0
- testit_python_commons/models/test_result.py +297 -0
- testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +28 -0
- testit_python_commons/services/__init__.py +41 -0
- testit_python_commons/services/adapter_manager.py +318 -0
- testit_python_commons/services/adapter_manager_configuration.py +42 -0
- testit_python_commons/services/fixture_manager.py +60 -0
- testit_python_commons/services/fixture_storage.py +40 -0
- testit_python_commons/services/logger.py +32 -0
- testit_python_commons/services/plugin_manager.py +101 -0
- testit_python_commons/services/retry.py +92 -0
- testit_python_commons/services/step_manager.py +36 -0
- testit_python_commons/services/step_result_storage.py +26 -0
- testit_python_commons/services/sync_storage/__init__.py +9 -0
- testit_python_commons/services/sync_storage/sync_storage_runner.py +589 -0
- testit_python_commons/services/utils.py +132 -0
- testit_python_commons/step.py +101 -0
- testit_python_commons/utils/__init__.py +3 -0
- testit_python_commons/utils/html_escape_utils.py +219 -0
- testit_python_commons-4.2.8.dist-info/METADATA +52 -0
- testit_python_commons-4.2.8.dist-info/RECORD +71 -0
- testit_python_commons-4.2.8.dist-info/WHEEL +5 -0
- testit_python_commons-4.2.8.dist-info/top_level.txt +3 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from testit_api_client.apis import AutoTestsApi, TestRunsApi
|
|
4
|
+
from testit_api_client.models import (
|
|
5
|
+
AutoTestCreateApiModel,
|
|
6
|
+
AutoTestUpdateApiModel,
|
|
7
|
+
AutoTestResultsForTestRunModel,
|
|
8
|
+
LinkAutoTestToWorkItemRequest,
|
|
9
|
+
AutoTestWorkItemIdentifierApiResult,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from testit_python_commons.client.client_configuration import ClientConfiguration
|
|
13
|
+
from testit_python_commons.client.helpers.threads_manager import ThreadsManager
|
|
14
|
+
from testit_python_commons.client.models import (
|
|
15
|
+
ThreadForCreateAndResult,
|
|
16
|
+
ThreadsForCreateAndResult,
|
|
17
|
+
ThreadForUpdateAndResult,
|
|
18
|
+
ThreadsForUpdateAndResult
|
|
19
|
+
)
|
|
20
|
+
from testit_python_commons.services.logger import adapter_logger
|
|
21
|
+
import testit_api_client
|
|
22
|
+
|
|
23
|
+
from testit_python_commons.services.retry import is_non_retriable_api_exception, retry
|
|
24
|
+
from testit_python_commons.utils.html_escape_utils import HtmlEscapeUtils
|
|
25
|
+
from typing import Dict, List
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BulkAutotestHelper:
|
|
29
|
+
__max_tests_for_import = 100
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
autotests_api: AutoTestsApi,
|
|
34
|
+
test_runs_api: TestRunsApi,
|
|
35
|
+
config: ClientConfiguration):
|
|
36
|
+
self.__autotests_api = autotests_api
|
|
37
|
+
self.__test_runs_api = test_runs_api
|
|
38
|
+
self.__test_run_id = config.get_test_run_id()
|
|
39
|
+
self.__automatic_updation_links_to_test_cases = config.get_automatic_updation_links_to_test_cases()
|
|
40
|
+
self.__threads_manager = ThreadsManager()
|
|
41
|
+
|
|
42
|
+
@adapter_logger
|
|
43
|
+
def add_for_create(
|
|
44
|
+
self,
|
|
45
|
+
create_model: AutoTestCreateApiModel,
|
|
46
|
+
result_model: AutoTestResultsForTestRunModel):
|
|
47
|
+
thread_for_create_and_result: ThreadForCreateAndResult = self.__threads_manager.\
|
|
48
|
+
get_thread_for_create_and_result(create_model.external_id)
|
|
49
|
+
|
|
50
|
+
thread_for_create: Dict[str, AutoTestCreateApiModel] = thread_for_create_and_result.get_thread_for_create()
|
|
51
|
+
thread_for_create[create_model.external_id] = create_model
|
|
52
|
+
|
|
53
|
+
thread_results_for_created_autotests: Dict[str, AutoTestResultsForTestRunModel] = thread_for_create_and_result\
|
|
54
|
+
.get_thread_results_for_created_autotests()
|
|
55
|
+
thread_results_for_created_autotests[result_model.auto_test_external_id] = result_model
|
|
56
|
+
|
|
57
|
+
if len(thread_for_create) >= self.__max_tests_for_import:
|
|
58
|
+
self.__teardown_for_create()
|
|
59
|
+
|
|
60
|
+
@adapter_logger
|
|
61
|
+
def add_for_update(
|
|
62
|
+
self,
|
|
63
|
+
update_model: AutoTestUpdateApiModel,
|
|
64
|
+
result_model: AutoTestResultsForTestRunModel,
|
|
65
|
+
autotest_links_to_wi_for_update: Dict[str, List[str]]):
|
|
66
|
+
thread_for_update_and_result: ThreadForUpdateAndResult = self.__threads_manager.\
|
|
67
|
+
get_thread_for_update_and_result(update_model.external_id)
|
|
68
|
+
|
|
69
|
+
thread_for_update: Dict[str, AutoTestUpdateApiModel] = thread_for_update_and_result.get_thread_for_update()
|
|
70
|
+
thread_for_update[update_model.external_id] = update_model
|
|
71
|
+
|
|
72
|
+
thread_results_for_updated_autotests: Dict[str, AutoTestResultsForTestRunModel] = thread_for_update_and_result\
|
|
73
|
+
.get_thread_results_for_updated_autotests()
|
|
74
|
+
thread_results_for_updated_autotests[result_model.auto_test_external_id] = result_model
|
|
75
|
+
|
|
76
|
+
thread_for_autotest_links_to_wi_for_update: Dict[str, List[str]] = thread_for_update_and_result\
|
|
77
|
+
.get_thread_for_autotest_links_to_wi_for_update()
|
|
78
|
+
thread_for_autotest_links_to_wi_for_update.update(autotest_links_to_wi_for_update)
|
|
79
|
+
|
|
80
|
+
if len(thread_for_update) >= self.__max_tests_for_import:
|
|
81
|
+
self.__teardown_for_update()
|
|
82
|
+
|
|
83
|
+
@adapter_logger
|
|
84
|
+
def teardown(self):
|
|
85
|
+
self.__teardown_for_create()
|
|
86
|
+
self.__teardown_for_update()
|
|
87
|
+
|
|
88
|
+
def __teardown_for_create(self):
|
|
89
|
+
all_threads_for_create_and_result: ThreadsForCreateAndResult = self.__threads_manager\
|
|
90
|
+
.get_all_threads_for_create_and_result()
|
|
91
|
+
|
|
92
|
+
thread_for_create: Dict[str, AutoTestCreateApiModel] = all_threads_for_create_and_result\
|
|
93
|
+
.get_threads_for_create()
|
|
94
|
+
autotests_for_create = list(thread_for_create.values())
|
|
95
|
+
|
|
96
|
+
if autotests_for_create:
|
|
97
|
+
self.__create_tests(autotests_for_create)
|
|
98
|
+
|
|
99
|
+
threads_results_for_created_autotests: List[Dict[str, AutoTestResultsForTestRunModel]] = all_threads_for_create_and_result\
|
|
100
|
+
.get_threads_results_for_created_autotests()
|
|
101
|
+
|
|
102
|
+
for thread_results_for_created_autotests in threads_results_for_created_autotests:
|
|
103
|
+
self.__load_test_results(list(thread_results_for_created_autotests.values()))
|
|
104
|
+
|
|
105
|
+
self.__threads_manager.delete_threads_for_create_and_result()
|
|
106
|
+
|
|
107
|
+
def __teardown_for_update(self):
|
|
108
|
+
all_threads_for_update_and_result: ThreadsForUpdateAndResult = self.__threads_manager\
|
|
109
|
+
.get_all_threads_for_update_and_result()
|
|
110
|
+
|
|
111
|
+
thread_for_update: Dict[str, AutoTestUpdateApiModel] = all_threads_for_update_and_result\
|
|
112
|
+
.get_threads_for_update()
|
|
113
|
+
|
|
114
|
+
autotests_for_update = list(thread_for_update.values())
|
|
115
|
+
|
|
116
|
+
if autotests_for_update:
|
|
117
|
+
self.__update_tests(autotests_for_update)
|
|
118
|
+
|
|
119
|
+
thread_for_autotest_links_to_wi_for_update: Dict[str, List[str]] = all_threads_for_update_and_result\
|
|
120
|
+
.get_threads_for_autotest_links_to_wi_for_update()
|
|
121
|
+
|
|
122
|
+
for autotest_id, work_item_ids in thread_for_autotest_links_to_wi_for_update.items():
|
|
123
|
+
self.__update_autotest_link_from_work_items(autotest_id, work_item_ids)
|
|
124
|
+
|
|
125
|
+
threads_results_for_updated_autotests: List[Dict[str, AutoTestResultsForTestRunModel]] = all_threads_for_update_and_result\
|
|
126
|
+
.get_threads_results_for_updated_autotests()
|
|
127
|
+
|
|
128
|
+
for thread_results_for_updated_autotests in threads_results_for_updated_autotests:
|
|
129
|
+
self.__load_test_results(list(thread_results_for_updated_autotests.values()))
|
|
130
|
+
|
|
131
|
+
self.__threads_manager.delete_threads_for_update_and_result()
|
|
132
|
+
|
|
133
|
+
@adapter_logger
|
|
134
|
+
def __bulk_create(
|
|
135
|
+
self,
|
|
136
|
+
thread_for_create: List[AutoTestCreateApiModel],
|
|
137
|
+
thread_results_for_created_autotests: List[AutoTestResultsForTestRunModel]
|
|
138
|
+
):
|
|
139
|
+
self.__create_tests(thread_for_create)
|
|
140
|
+
self.__load_test_results(thread_results_for_created_autotests)
|
|
141
|
+
|
|
142
|
+
@adapter_logger
|
|
143
|
+
def __bulk_update(
|
|
144
|
+
self,
|
|
145
|
+
thread_for_update: Dict[str, AutoTestUpdateApiModel],
|
|
146
|
+
thread_results_for_updated_autotests: List[AutoTestResultsForTestRunModel],
|
|
147
|
+
thread_for_autotest_links_to_wi_for_update: Dict[str, List[str]]
|
|
148
|
+
):
|
|
149
|
+
self.__update_tests(list(thread_for_update.values()))
|
|
150
|
+
self.__load_test_results(thread_results_for_updated_autotests)
|
|
151
|
+
|
|
152
|
+
for autotest_id, work_item_ids in thread_for_autotest_links_to_wi_for_update.items():
|
|
153
|
+
self.__update_autotest_link_from_work_items(autotest_id, work_item_ids)
|
|
154
|
+
|
|
155
|
+
@adapter_logger
|
|
156
|
+
def __create_tests(self, autotests_for_create: List[AutoTestCreateApiModel]):
|
|
157
|
+
# logging.debug(f'Creating autotests: "{autotests_for_create}')
|
|
158
|
+
|
|
159
|
+
autotests_for_create = HtmlEscapeUtils.escape_html_in_object(autotests_for_create)
|
|
160
|
+
self.__autotests_api.create_multiple(auto_test_create_api_model=autotests_for_create)
|
|
161
|
+
|
|
162
|
+
logging.debug(f'Autotests were created')
|
|
163
|
+
|
|
164
|
+
@adapter_logger
|
|
165
|
+
def __update_tests(self, autotests_for_update: List[AutoTestUpdateApiModel]):
|
|
166
|
+
# logging.debug(f'Updating autotests: {autotests_for_update}')
|
|
167
|
+
|
|
168
|
+
autotests_for_update = HtmlEscapeUtils.escape_html_in_object(autotests_for_update)
|
|
169
|
+
self.__autotests_api.update_multiple(auto_test_update_api_model=autotests_for_update)
|
|
170
|
+
|
|
171
|
+
logging.debug(f'Autotests were updated')
|
|
172
|
+
|
|
173
|
+
@adapter_logger
|
|
174
|
+
def __load_test_results(self, test_results: List[AutoTestResultsForTestRunModel]):
|
|
175
|
+
# logging.debug(f'Loading test results: {test_results}')
|
|
176
|
+
|
|
177
|
+
test_results = HtmlEscapeUtils.escape_html_in_object(test_results)
|
|
178
|
+
self.__test_runs_api.set_auto_test_results_for_test_run(
|
|
179
|
+
id=self.__test_run_id,
|
|
180
|
+
auto_test_results_for_test_run_model=test_results)
|
|
181
|
+
|
|
182
|
+
# TODO: delete after fix PUT/api/v2/autoTests
|
|
183
|
+
@adapter_logger
|
|
184
|
+
def __get_work_items_linked_to_autotest(self, autotest_global_id: str) -> List[AutoTestWorkItemIdentifierApiResult]:
|
|
185
|
+
return self.__autotests_api.get_work_items_linked_to_auto_test(id=autotest_global_id)
|
|
186
|
+
|
|
187
|
+
# TODO: delete after fix PUT/api/v2/autoTests
|
|
188
|
+
@adapter_logger
|
|
189
|
+
@retry
|
|
190
|
+
def __unlink_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
191
|
+
try:
|
|
192
|
+
self.__autotests_api.delete_auto_test_link_from_work_item(
|
|
193
|
+
id=autotest_global_id,
|
|
194
|
+
work_item_id=work_item_id)
|
|
195
|
+
except testit_api_client.exceptions.ApiException as exc:
|
|
196
|
+
if is_non_retriable_api_exception(exc):
|
|
197
|
+
logging.warning(
|
|
198
|
+
'Cannot unlink autotest %s from work item %s: %s',
|
|
199
|
+
autotest_global_id,
|
|
200
|
+
work_item_id,
|
|
201
|
+
exc,
|
|
202
|
+
)
|
|
203
|
+
return
|
|
204
|
+
raise
|
|
205
|
+
|
|
206
|
+
logging.debug(f'Autotest was unlinked with workItem "{work_item_id}" by global id "{autotest_global_id}')
|
|
207
|
+
|
|
208
|
+
# TODO: delete after fix PUT/api/v2/autoTests
|
|
209
|
+
@adapter_logger
|
|
210
|
+
@retry
|
|
211
|
+
def __link_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
212
|
+
try:
|
|
213
|
+
self.__autotests_api.link_auto_test_to_work_item(
|
|
214
|
+
autotest_global_id,
|
|
215
|
+
link_auto_test_to_work_item_request=LinkAutoTestToWorkItemRequest(id=work_item_id))
|
|
216
|
+
except testit_api_client.exceptions.ApiException as exc:
|
|
217
|
+
if is_non_retriable_api_exception(exc):
|
|
218
|
+
logging.warning(
|
|
219
|
+
'Cannot link autotest %s to work item %s: %s',
|
|
220
|
+
autotest_global_id,
|
|
221
|
+
work_item_id,
|
|
222
|
+
exc,
|
|
223
|
+
)
|
|
224
|
+
return
|
|
225
|
+
raise
|
|
226
|
+
|
|
227
|
+
logging.debug(f'Autotest was linked with workItem "{work_item_id}" by global id "{autotest_global_id}')
|
|
228
|
+
|
|
229
|
+
# TODO: delete after fix PUT/api/v2/autoTests
|
|
230
|
+
@adapter_logger
|
|
231
|
+
def __update_autotest_link_from_work_items(self, autotest_global_id: str, work_item_ids: list):
|
|
232
|
+
linked_work_items = self.__get_work_items_linked_to_autotest(autotest_global_id)
|
|
233
|
+
|
|
234
|
+
for linked_work_item in linked_work_items:
|
|
235
|
+
linked_work_item_id = str(linked_work_item.global_id)
|
|
236
|
+
|
|
237
|
+
if linked_work_item_id in work_item_ids:
|
|
238
|
+
work_item_ids.remove(linked_work_item_id)
|
|
239
|
+
|
|
240
|
+
continue
|
|
241
|
+
|
|
242
|
+
if self.__automatic_updation_links_to_test_cases:
|
|
243
|
+
self.__unlink_test_to_work_item(autotest_global_id, linked_work_item_id)
|
|
244
|
+
|
|
245
|
+
for work_item_id in work_item_ids:
|
|
246
|
+
self.__link_test_to_work_item(autotest_global_id, work_item_id)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from testit_api_client.models import (
|
|
2
|
+
AutoTestCreateApiModel,
|
|
3
|
+
AutoTestUpdateApiModel,
|
|
4
|
+
AutoTestResultsForTestRunModel,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from testit_python_commons.client.models import (
|
|
8
|
+
ThreadForCreateAndResult,
|
|
9
|
+
ThreadsForCreateAndResult,
|
|
10
|
+
ThreadForUpdateAndResult,
|
|
11
|
+
ThreadsForUpdateAndResult
|
|
12
|
+
)
|
|
13
|
+
from testit_python_commons.services.logger import adapter_logger
|
|
14
|
+
from typing import Dict, List
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ThreadsManager:
|
|
18
|
+
def __init__(self):
|
|
19
|
+
self.__thread_for_create: Dict[str, AutoTestCreateApiModel] = {}
|
|
20
|
+
self.__thread_for_update: Dict[str, AutoTestUpdateApiModel] = {}
|
|
21
|
+
self.__threads_results_for_created_autotests: List[Dict[str, AutoTestResultsForTestRunModel]] = []
|
|
22
|
+
self.__threads_results_for_updated_autotests: List[Dict[str, AutoTestResultsForTestRunModel]] = []
|
|
23
|
+
self.__thread_for_autotest_links_to_wi_for_update: Dict[str, List[str]] = {}
|
|
24
|
+
|
|
25
|
+
@adapter_logger
|
|
26
|
+
def get_thread_for_create_and_result(self, external_id: str) -> ThreadForCreateAndResult:
|
|
27
|
+
thread_results_for_created_autotests = self.__get_thread_results_for_created_autotests(external_id)
|
|
28
|
+
|
|
29
|
+
return ThreadForCreateAndResult(self.__thread_for_create, thread_results_for_created_autotests)
|
|
30
|
+
|
|
31
|
+
@adapter_logger
|
|
32
|
+
def get_all_threads_for_create_and_result(self) -> ThreadsForCreateAndResult:
|
|
33
|
+
return ThreadsForCreateAndResult(self.__thread_for_create, self.__threads_results_for_created_autotests)
|
|
34
|
+
|
|
35
|
+
@adapter_logger
|
|
36
|
+
def get_thread_for_update_and_result(self, external_id: str) -> ThreadForUpdateAndResult:
|
|
37
|
+
thread_results_for_updated_autotests = self.__get_thread_results_for_updated_autotests(external_id)
|
|
38
|
+
|
|
39
|
+
return ThreadForUpdateAndResult(
|
|
40
|
+
self.__thread_for_update,
|
|
41
|
+
thread_results_for_updated_autotests,
|
|
42
|
+
self.__thread_for_autotest_links_to_wi_for_update
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
@adapter_logger
|
|
46
|
+
def get_all_threads_for_update_and_result(self) -> ThreadsForUpdateAndResult:
|
|
47
|
+
return ThreadsForUpdateAndResult(
|
|
48
|
+
self.__thread_for_update,
|
|
49
|
+
self.__threads_results_for_updated_autotests,
|
|
50
|
+
self.__thread_for_autotest_links_to_wi_for_update
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@adapter_logger
|
|
54
|
+
def delete_threads_for_create_and_result(self):
|
|
55
|
+
self.__thread_for_create.clear()
|
|
56
|
+
self.__threads_results_for_created_autotests.clear()
|
|
57
|
+
|
|
58
|
+
@adapter_logger
|
|
59
|
+
def delete_threads_for_update_and_result(self):
|
|
60
|
+
self.__thread_for_update.clear()
|
|
61
|
+
self.__threads_results_for_updated_autotests.clear()
|
|
62
|
+
self.__thread_for_autotest_links_to_wi_for_update.clear()
|
|
63
|
+
|
|
64
|
+
@adapter_logger
|
|
65
|
+
def __get_thread_results_for_created_autotests(self, external_id: str) -> Dict[str, AutoTestResultsForTestRunModel]:
|
|
66
|
+
for thread in self.__threads_results_for_created_autotests:
|
|
67
|
+
if external_id not in thread.keys():
|
|
68
|
+
return thread
|
|
69
|
+
|
|
70
|
+
new_thread: Dict[str, AutoTestResultsForTestRunModel] = {}
|
|
71
|
+
|
|
72
|
+
self.__threads_results_for_created_autotests.append(new_thread)
|
|
73
|
+
|
|
74
|
+
return new_thread
|
|
75
|
+
|
|
76
|
+
@adapter_logger
|
|
77
|
+
def __get_thread_results_for_updated_autotests(self, external_id: str) -> Dict[str, AutoTestResultsForTestRunModel]:
|
|
78
|
+
for thread in self.__threads_results_for_updated_autotests:
|
|
79
|
+
if external_id not in thread.keys():
|
|
80
|
+
return thread
|
|
81
|
+
|
|
82
|
+
new_thread: Dict[str, AutoTestResultsForTestRunModel] = {}
|
|
83
|
+
|
|
84
|
+
self.__threads_results_for_updated_autotests.append(new_thread)
|
|
85
|
+
|
|
86
|
+
return new_thread
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from testit_python_commons.client.models.threads_for_create_and_result import (
|
|
2
|
+
ThreadForCreateAndResult,
|
|
3
|
+
ThreadsForCreateAndResult
|
|
4
|
+
)
|
|
5
|
+
from testit_python_commons.client.models.threads_for_update_and_result import (
|
|
6
|
+
ThreadForUpdateAndResult,
|
|
7
|
+
ThreadsForUpdateAndResult
|
|
8
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
from testit_api_client.models import AutoTestCreateApiModel, AutoTestResultsForTestRunModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ThreadForCreateAndResult:
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
thread_for_create: Dict[str, AutoTestCreateApiModel],
|
|
10
|
+
thread_results_for_created_autotests: Dict[str, AutoTestResultsForTestRunModel]
|
|
11
|
+
):
|
|
12
|
+
self.__thread_for_create = thread_for_create
|
|
13
|
+
self.__thread_results_for_created_autotests = thread_results_for_created_autotests
|
|
14
|
+
|
|
15
|
+
def get_thread_for_create(self) -> Dict[str, AutoTestCreateApiModel]:
|
|
16
|
+
return self.__thread_for_create
|
|
17
|
+
|
|
18
|
+
def get_thread_results_for_created_autotests(self) -> Dict[str, AutoTestResultsForTestRunModel]:
|
|
19
|
+
return self.__thread_results_for_created_autotests
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ThreadsForCreateAndResult:
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
threads_for_create: Dict[str, AutoTestCreateApiModel],
|
|
26
|
+
threads_results_for_created_autotests: List[Dict[str, AutoTestResultsForTestRunModel]]
|
|
27
|
+
):
|
|
28
|
+
self.__threads_for_create = threads_for_create
|
|
29
|
+
self.__threads_results_for_created_autotests = threads_results_for_created_autotests
|
|
30
|
+
|
|
31
|
+
def get_threads_for_create(self) -> Dict[str, AutoTestCreateApiModel]:
|
|
32
|
+
return self.__threads_for_create
|
|
33
|
+
|
|
34
|
+
def get_threads_results_for_created_autotests(self) -> List[Dict[str, AutoTestResultsForTestRunModel]]:
|
|
35
|
+
return self.__threads_results_for_created_autotests
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from typing import Dict, List
|
|
2
|
+
|
|
3
|
+
from testit_api_client.models import AutoTestUpdateApiModel, AutoTestResultsForTestRunModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ThreadForUpdateAndResult:
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
thread_for_update: Dict[str, AutoTestUpdateApiModel],
|
|
10
|
+
thread_results_for_updated_autotests: Dict[str, AutoTestResultsForTestRunModel],
|
|
11
|
+
thread_for_autotest_links_to_wi_for_update: Dict[str, List[str]]
|
|
12
|
+
):
|
|
13
|
+
self.__thread_for_update = thread_for_update
|
|
14
|
+
self.__thread_results_for_updated_autotests = thread_results_for_updated_autotests
|
|
15
|
+
self.__thread_for_autotest_links_to_wi_for_update = thread_for_autotest_links_to_wi_for_update
|
|
16
|
+
|
|
17
|
+
def get_thread_for_update(self) -> Dict[str, AutoTestUpdateApiModel]:
|
|
18
|
+
return self.__thread_for_update
|
|
19
|
+
|
|
20
|
+
def get_thread_results_for_updated_autotests(self) -> Dict[str, AutoTestResultsForTestRunModel]:
|
|
21
|
+
return self.__thread_results_for_updated_autotests
|
|
22
|
+
|
|
23
|
+
def get_thread_for_autotest_links_to_wi_for_update(self) -> Dict[str, List[str]]:
|
|
24
|
+
return self.__thread_for_autotest_links_to_wi_for_update
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ThreadsForUpdateAndResult:
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
threads_for_update: Dict[str, AutoTestUpdateApiModel],
|
|
31
|
+
threads_results_for_updated_autotests: List[Dict[str, AutoTestResultsForTestRunModel]],
|
|
32
|
+
threads_for_autotest_links_to_wi_for_update: Dict[str, List[str]]
|
|
33
|
+
):
|
|
34
|
+
self.__threads_for_update = threads_for_update
|
|
35
|
+
self.__threads_results_for_updated_autotests = threads_results_for_updated_autotests
|
|
36
|
+
self.__threads_for_autotest_links_to_wi_for_update = threads_for_autotest_links_to_wi_for_update
|
|
37
|
+
|
|
38
|
+
def get_threads_for_update(self) -> Dict[str, AutoTestUpdateApiModel]:
|
|
39
|
+
return self.__threads_for_update
|
|
40
|
+
|
|
41
|
+
def get_threads_results_for_updated_autotests(self) -> List[Dict[str, AutoTestResultsForTestRunModel]]:
|
|
42
|
+
return self.__threads_results_for_updated_autotests
|
|
43
|
+
|
|
44
|
+
def get_threads_for_autotest_links_to_wi_for_update(self) -> Dict[str, List[str]]:
|
|
45
|
+
return self.__threads_for_autotest_links_to_wi_for_update
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
# input values from configuration file
|
|
3
|
+
class PropertiesNames:
|
|
4
|
+
URL = 'url'
|
|
5
|
+
PRIVATE_TOKEN = 'privatetoken'
|
|
6
|
+
PROJECT_ID = "projectid"
|
|
7
|
+
CONFIGURATION_ID = 'configurationid'
|
|
8
|
+
TEST_RUN_ID = 'testrunid'
|
|
9
|
+
TEST_RUN_NAME = 'testrunname'
|
|
10
|
+
TMS_PROXY = 'tmsproxy'
|
|
11
|
+
ADAPTER_MODE = 'adaptermode'
|
|
12
|
+
CERT_VALIDATION = 'certvalidation'
|
|
13
|
+
AUTOMATIC_CREATION_TEST_CASES = 'automaticcreationtestcases'
|
|
14
|
+
AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES = 'automaticupdationlinkstotestcases'
|
|
15
|
+
IMPORT_REALTIME = 'importrealtime'
|
|
16
|
+
SYNC_STORAGE_PORT = 'syncstorageport'
|
|
17
|
+
LEGACY_WORKFLOW = 'legacyworkflow'
|
|
18
|
+
|
|
19
|
+
ENV_TO_PROPERTY = {
|
|
20
|
+
'TMS_URL': PropertiesNames.URL,
|
|
21
|
+
'TMS_PRIVATE_TOKEN': PropertiesNames.PRIVATE_TOKEN,
|
|
22
|
+
'TMS_PROJECT_ID': PropertiesNames.PROJECT_ID,
|
|
23
|
+
'TMS_CONFIGURATION_ID': PropertiesNames.CONFIGURATION_ID,
|
|
24
|
+
'TMS_TEST_RUN_ID': PropertiesNames.TEST_RUN_ID,
|
|
25
|
+
'TMS_TEST_RUN_NAME': PropertiesNames.TEST_RUN_NAME,
|
|
26
|
+
'TMS_PROXY': PropertiesNames.TMS_PROXY,
|
|
27
|
+
'TMS_ADAPTER_MODE': PropertiesNames.ADAPTER_MODE,
|
|
28
|
+
'TMS_CERT_VALIDATION': PropertiesNames.CERT_VALIDATION,
|
|
29
|
+
'TMS_AUTOMATIC_CREATION_TEST_CASES': PropertiesNames.AUTOMATIC_CREATION_TEST_CASES,
|
|
30
|
+
'TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES': PropertiesNames.AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES,
|
|
31
|
+
'TMS_IMPORT_REALTIME': PropertiesNames.IMPORT_REALTIME,
|
|
32
|
+
'TMS_SYNC_STORAGE_PORT': PropertiesNames.SYNC_STORAGE_PORT,
|
|
33
|
+
'TMS_LEGACY_WORKFLOW': PropertiesNames.LEGACY_WORKFLOW,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
OPTION_TO_PROPERTY = {
|
|
37
|
+
'set_url': PropertiesNames.URL,
|
|
38
|
+
'set_private_token': PropertiesNames.PRIVATE_TOKEN,
|
|
39
|
+
'set_project_id': PropertiesNames.PROJECT_ID,
|
|
40
|
+
'set_configuration_id': PropertiesNames.CONFIGURATION_ID,
|
|
41
|
+
'set_test_run_id': PropertiesNames.TEST_RUN_ID,
|
|
42
|
+
'set_test_run_name': PropertiesNames.TEST_RUN_NAME,
|
|
43
|
+
'set_tms_proxy': PropertiesNames.TMS_PROXY,
|
|
44
|
+
'set_adapter_mode': PropertiesNames.ADAPTER_MODE,
|
|
45
|
+
'set_cert_validation': PropertiesNames.CERT_VALIDATION,
|
|
46
|
+
'set_automatic_creation_test_cases': PropertiesNames.AUTOMATIC_CREATION_TEST_CASES,
|
|
47
|
+
'set_automatic_updation_links_to_test_cases': PropertiesNames.AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES,
|
|
48
|
+
'set_import_realtime': PropertiesNames.IMPORT_REALTIME,
|
|
49
|
+
'set_sync_storage_port': PropertiesNames.SYNC_STORAGE_PORT,
|
|
50
|
+
'set_legacy_workflow': PropertiesNames.LEGACY_WORKFLOW,
|
|
51
|
+
}
|