testit-python-commons 3.6.7.post540__tar.gz → 3.7.0.post530__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.
Files changed (45) hide show
  1. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/PKG-INFO +2 -2
  2. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/setup.py +2 -2
  3. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/client/api_client.py +40 -14
  4. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/client/converter.py +86 -13
  5. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  6. testit_python_commons-3.7.0.post530/src/testit_python_commons.egg-info/requires.txt +3 -0
  7. testit_python_commons-3.6.7.post540/src/testit_python_commons.egg-info/requires.txt +0 -3
  8. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/README.md +0 -0
  9. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/setup.cfg +0 -0
  10. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit.py +0 -0
  11. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/__init__.py +0 -0
  12. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/app_properties.py +0 -0
  13. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/client/__init__.py +0 -0
  14. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/client/client_configuration.py +0 -0
  15. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/decorators.py +0 -0
  16. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/dynamic_methods.py +0 -0
  17. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/__init__.py +0 -0
  18. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/adapter_mode.py +0 -0
  19. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/fixture.py +0 -0
  20. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/link.py +0 -0
  21. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/link_type.py +0 -0
  22. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/outcome_type.py +0 -0
  23. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/step_result.py +0 -0
  24. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/test_result.py +0 -0
  25. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  26. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/__init__.py +0 -0
  27. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/adapter_manager.py +0 -0
  28. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  29. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/fixture_manager.py +0 -0
  30. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/fixture_storage.py +0 -0
  31. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/logger.py +0 -0
  32. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/plugin_manager.py +0 -0
  33. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/retry.py +0 -0
  34. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/step_manager.py +0 -0
  35. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/step_result_storage.py +0 -0
  36. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/services/utils.py +0 -0
  37. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/step.py +0 -0
  38. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/utils/__init__.py +0 -0
  39. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons/utils/html_escape_utils.py +0 -0
  40. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
  41. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  42. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/src/testit_python_commons.egg-info/top_level.txt +0 -0
  43. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/tests/test_app_properties.py +0 -0
  44. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/tests/test_dynamic_methods.py +0 -0
  45. {testit_python_commons-3.6.7.post540 → testit_python_commons-3.7.0.post530}/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.6.7.post540
3
+ Version: 3.7.0.post530
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==6.3.1.post540
20
+ Requires-Dist: testit-api-client==7.0.0.post530
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.6.7.post540"
3
+ VERSION = "3.7.0.post530"
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==6.3.1.post540']
28
+ install_requires=['pluggy', 'tomli', 'testit-api-client==7.0.0.post530']
29
29
  )
@@ -4,7 +4,7 @@ import typing
4
4
  from datetime import datetime
5
5
 
6
6
  from testit_api_client import ApiClient, Configuration
7
- from testit_api_client.api import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi, WorkItemsApi
7
+ from testit_api_client.apis import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi, WorkItemsApi
8
8
  from testit_api_client.models import (
9
9
  AutoTestApiResult,
10
10
  AutoTestPostModel,
@@ -73,7 +73,7 @@ class ApiClientWorker:
73
73
  )
74
74
  model = self._escape_html_in_model(model)
75
75
 
76
- response = self.__test_run_api.create_empty(create_empty_test_run_api_model=model)
76
+ response = self.__test_run_api.create_empty(create_empty_request=model)
77
77
 
78
78
  return Converter.get_id_from_create_test_run_response(response)
79
79
 
@@ -95,7 +95,7 @@ class ApiClientWorker:
95
95
  self.__config.get_project_id(),
96
96
  test_result.get_external_id())
97
97
 
98
- autotests = self.__autotest_api.api_v2_auto_tests_search_post(auto_test_search_api_model=model)
98
+ autotests = self.__autotest_api.api_v2_auto_tests_search_post(api_v2_auto_tests_search_post_request=model)
99
99
 
100
100
  if autotests:
101
101
  self.__update_test(test_result, autotests[0])
@@ -122,10 +122,10 @@ class ApiClientWorker:
122
122
  test_result,
123
123
  self.__config.get_configuration_id())
124
124
 
125
- autotests = self.__autotest_api.api_v2_auto_tests_search_post(auto_test_search_api_model=model)
125
+ autotests = self.__autotest_api.api_v2_auto_tests_search_post(api_v2_auto_tests_search_post_request=model)
126
126
 
127
127
  if autotests:
128
- autotest_for_update = self.__prepare_to_update_autotest(test_result, autotests[0])
128
+ autotest_for_update = self.__prepare_to_mass_update_autotest(test_result, autotests[0])
129
129
 
130
130
  autotests_for_update.append(autotest_for_update)
131
131
  results_for_autotests_being_updated.append(test_result_model)
@@ -137,7 +137,7 @@ class ApiClientWorker:
137
137
  autotests_for_update.clear()
138
138
  results_for_autotests_being_updated.clear()
139
139
  else:
140
- autotest_for_create = self.__prepare_to_create_autotest(test_result)
140
+ autotest_for_create = self.__prepare_to_mass_create_autotest(test_result)
141
141
 
142
142
  autotests_for_create.append(autotest_for_create)
143
143
  results_for_autotests_being_created.append(test_result_model)
@@ -167,6 +167,18 @@ class ApiClientWorker:
167
167
  def __prepare_to_create_autotest(self, test_result: TestResult) -> AutoTestPostModel:
168
168
  logging.debug('Preparing to create the auto test ' + test_result.get_external_id())
169
169
 
170
+ model = Converter.test_result_to_create_autotest_request(
171
+ test_result,
172
+ self.__config.get_project_id())
173
+ model.work_item_ids_for_link_with_auto_test = self.__get_work_item_uuids_for_link_with_auto_test(
174
+ test_result.get_work_item_ids())
175
+
176
+ return model
177
+
178
+ @adapter_logger
179
+ def __prepare_to_mass_create_autotest(self, test_result: TestResult) -> AutoTestPostModel:
180
+ logging.debug('Preparing to create the auto test ' + test_result.get_external_id())
181
+
170
182
  model = Converter.test_result_to_autotest_post_model(
171
183
  test_result,
172
184
  self.__config.get_project_id())
@@ -182,6 +194,23 @@ class ApiClientWorker:
182
194
  autotest: AutoTestApiResult) -> AutoTestPutModel:
183
195
  logging.debug('Preparing to update the auto test ' + test_result.get_external_id())
184
196
 
197
+ model = Converter.test_result_to_update_autotest_request(
198
+ test_result,
199
+ self.__config.get_project_id())
200
+ model.is_flaky = autotest.is_flaky
201
+ model.work_item_ids_for_link_with_auto_test = self.__get_work_item_uuids_for_link_with_auto_test(
202
+ test_result.get_work_item_ids(),
203
+ str(autotest.global_id))
204
+
205
+ return model
206
+
207
+ @adapter_logger
208
+ def __prepare_to_mass_update_autotest(
209
+ self,
210
+ test_result: TestResult,
211
+ autotest: AutoTestApiResult) -> AutoTestPutModel:
212
+ logging.debug('Preparing to update the auto test ' + test_result.get_external_id())
213
+
185
214
  model = Converter.test_result_to_autotest_put_model(
186
215
  test_result,
187
216
  self.__config.get_project_id())
@@ -297,7 +326,7 @@ class ApiClientWorker:
297
326
  model = self.__prepare_to_create_autotest(test_result)
298
327
  model = self._escape_html_in_model(model)
299
328
 
300
- autotest_response = self.__autotest_api.create_auto_test(auto_test_post_model=model)
329
+ autotest_response = self.__autotest_api.create_auto_test(create_auto_test_request=model)
301
330
 
302
331
  logging.debug(f'Autotest "{test_result.get_autotest_name()}" was created')
303
332
 
@@ -319,7 +348,7 @@ class ApiClientWorker:
319
348
  model = self.__prepare_to_update_autotest(test_result, autotest)
320
349
  model = self._escape_html_in_model(model)
321
350
 
322
- self.__autotest_api.update_auto_test(auto_test_put_model=model)
351
+ self.__autotest_api.update_auto_test(update_auto_test_request=model)
323
352
 
324
353
  logging.debug(f'Autotest "{test_result.get_autotest_name()}" was updated')
325
354
 
@@ -398,7 +427,7 @@ class ApiClientWorker:
398
427
  try:
399
428
  self.__test_results_api.api_v2_test_results_id_put(
400
429
  id=test_result.get_test_result_id(),
401
- test_result_update_v2_request=model)
430
+ api_v2_test_results_id_put_request=model)
402
431
  except Exception as exc:
403
432
  logging.error(f'Cannot update test result with id "{test_result.get_test_result_id()}" status: {exc}')
404
433
 
@@ -409,12 +438,9 @@ class ApiClientWorker:
409
438
  for path in attach_paths:
410
439
  if os.path.isfile(path):
411
440
  try:
412
- attachment_response = self.__attachments_api.api_v2_attachments_post(
413
- file=path)
441
+ attachment_response = self.__attachments_api.api_v2_attachments_post(file=open(path, "rb"))
414
442
 
415
- attachment_model = AttachmentPutModel(id=attachment_response.id)
416
- attachment_model = self._escape_html_in_model(attachment_model)
417
- attachments.append(attachment_model)
443
+ attachments.append(AttachmentPutModel(attachment_response['id']))
418
444
 
419
445
  logging.debug(f'Attachment "{path}" was uploaded')
420
446
  except Exception as exc:
@@ -3,6 +3,8 @@ import typing
3
3
  from testit_api_client.models import (
4
4
  AttachmentPutModelAutoTestStepResultsModel,
5
5
  AutoTestStepResultUpdateRequest,
6
+ CreateAutoTestRequest,
7
+ UpdateAutoTestRequest,
6
8
  AutoTestPostModel,
7
9
  AutoTestPutModel,
8
10
  AutoTestResultsForTestRunModel,
@@ -11,12 +13,12 @@ from testit_api_client.models import (
11
13
  LinkPostModel,
12
14
  LinkPutModel,
13
15
  LinkType,
14
- CreateEmptyTestRunApiModel,
16
+ CreateEmptyRequest,
15
17
  TestRunV2ApiResult,
16
- AutoTestFilterApiModel,
17
- AutoTestSearchIncludeApiModel,
18
- AutoTestSearchApiModel,
19
- TestResultUpdateV2Request,
18
+ AutoTestSearchApiModelFilter,
19
+ AutoTestSearchApiModelIncludes,
20
+ ApiV2AutoTestsSearchPostRequest,
21
+ ApiV2TestResultsIdPutRequest,
20
22
  TestResultResponse,
21
23
  TestResultV2GetModel,
22
24
  AttachmentApiResult,
@@ -34,7 +36,7 @@ class Converter:
34
36
  @classmethod
35
37
  @adapter_logger
36
38
  def test_run_to_test_run_short_model(cls, project_id, name):
37
- return CreateEmptyTestRunApiModel(
39
+ return CreateEmptyRequest(
38
40
  project_id=project_id,
39
41
  name=name
40
42
  )
@@ -54,16 +56,16 @@ class Converter:
54
56
  @classmethod
55
57
  @adapter_logger
56
58
  def project_id_and_external_id_to_auto_tests_search_post_request(cls, project_id: str, external_id: str):
57
- autotests_filter = AutoTestFilterApiModel(
59
+ autotests_filter = AutoTestSearchApiModelFilter(
58
60
  project_ids=[project_id],
59
61
  external_ids=[external_id],
60
62
  is_deleted=False)
61
- autotests_includes = AutoTestSearchIncludeApiModel(
63
+ autotests_includes = AutoTestSearchApiModelIncludes(
62
64
  include_steps=False,
63
65
  include_links=False,
64
66
  include_labels=False)
65
67
 
66
- return AutoTestSearchApiModel(filter=autotests_filter, includes=autotests_includes)
68
+ return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
67
69
 
68
70
  @staticmethod
69
71
  @adapter_logger
@@ -102,6 +104,32 @@ class Converter:
102
104
  external_key=test_result.get_external_key()
103
105
  )
104
106
 
107
+ @classmethod
108
+ @adapter_logger
109
+ def test_result_to_create_autotest_request(
110
+ cls,
111
+ test_result: TestResult,
112
+ project_id: str):
113
+ return CreateAutoTestRequest(
114
+ external_id=test_result.get_external_id(),
115
+ project_id=project_id,
116
+ name=test_result.get_autotest_name(),
117
+ steps=cls.step_results_to_autotest_steps_model(
118
+ test_result.get_step_results()),
119
+ setup=cls.step_results_to_autotest_steps_model(
120
+ test_result.get_setup_results()),
121
+ teardown=cls.step_results_to_autotest_steps_model(
122
+ test_result.get_teardown_results()),
123
+ namespace=test_result.get_namespace(),
124
+ classname=test_result.get_classname(),
125
+ title=test_result.get_title(),
126
+ description=test_result.get_description(),
127
+ links=cls.links_to_links_post_model(test_result.get_links()),
128
+ labels=test_result.get_labels(),
129
+ should_create_work_item=test_result.get_automatic_creation_test_cases(),
130
+ external_key=test_result.get_external_key()
131
+ )
132
+
105
133
  @classmethod
106
134
  @adapter_logger
107
135
  def test_result_to_autotest_put_model(
@@ -147,6 +175,51 @@ class Converter:
147
175
  external_key=test_result.get_external_key()
148
176
  )
149
177
 
178
+ @classmethod
179
+ @adapter_logger
180
+ def test_result_to_update_autotest_request(
181
+ cls,
182
+ test_result: TestResult,
183
+ project_id: str):
184
+ if test_result.get_outcome() == 'Passed':
185
+ return UpdateAutoTestRequest(
186
+ external_id=test_result.get_external_id(),
187
+ project_id=project_id,
188
+ name=test_result.get_autotest_name(),
189
+ steps=cls.step_results_to_autotest_steps_model(
190
+ test_result.get_step_results()),
191
+ setup=cls.step_results_to_autotest_steps_model(
192
+ test_result.get_setup_results()),
193
+ teardown=cls.step_results_to_autotest_steps_model(
194
+ test_result.get_teardown_results()),
195
+ namespace=test_result.get_namespace(),
196
+ classname=test_result.get_classname(),
197
+ title=test_result.get_title(),
198
+ description=test_result.get_description(),
199
+ links=cls.links_to_links_put_model(test_result.get_links()),
200
+ labels=test_result.get_labels(),
201
+ external_key=test_result.get_external_key()
202
+ )
203
+ else:
204
+ return UpdateAutoTestRequest(
205
+ external_id=test_result.get_external_id(),
206
+ project_id=project_id,
207
+ name=test_result.get_autotest_name(),
208
+ steps=cls.step_results_to_autotest_steps_model(
209
+ test_result.get_step_results()),
210
+ setup=cls.step_results_to_autotest_steps_model(
211
+ test_result.get_setup_results()),
212
+ teardown=cls.step_results_to_autotest_steps_model(
213
+ test_result.get_teardown_results()),
214
+ namespace=test_result.get_namespace(),
215
+ classname=test_result.get_classname(),
216
+ title=test_result.get_title(),
217
+ description=test_result.get_description(),
218
+ links=cls.links_to_links_put_model(test_result.get_links()),
219
+ labels=test_result.get_labels(),
220
+ external_key=test_result.get_external_key()
221
+ )
222
+
150
223
  @classmethod
151
224
  @adapter_logger
152
225
  def test_result_to_testrun_result_post_model(
@@ -179,8 +252,8 @@ class Converter:
179
252
  @adapter_logger
180
253
  def convert_test_result_model_to_test_results_id_put_request(
181
254
  cls,
182
- test_result: TestResultResponse) -> TestResultUpdateV2Request:
183
- return TestResultUpdateV2Request(
255
+ test_result: TestResultResponse) -> ApiV2TestResultsIdPutRequest:
256
+ return ApiV2TestResultsIdPutRequest(
184
257
  failure_class_ids=test_result.failure_class_ids,
185
258
  outcome=test_result.outcome,
186
259
  comment=test_result.comment,
@@ -198,8 +271,8 @@ class Converter:
198
271
  @adapter_logger
199
272
  def convert_test_result_with_all_setup_and_teardown_steps_to_test_results_id_put_request(
200
273
  cls,
201
- test_result: TestResultWithAllFixtureStepResults) -> TestResultUpdateV2Request:
202
- return TestResultUpdateV2Request(
274
+ test_result: TestResultWithAllFixtureStepResults) -> ApiV2TestResultsIdPutRequest:
275
+ return ApiV2TestResultsIdPutRequest(
203
276
  setup_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
204
277
  test_result.get_setup_results()),
205
278
  teardown_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 3.6.7.post540
3
+ Version: 3.7.0.post530
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==6.3.1.post540
20
+ Requires-Dist: testit-api-client==7.0.0.post530
21
21
  Dynamic: author
22
22
  Dynamic: author-email
23
23
  Dynamic: classifier
@@ -0,0 +1,3 @@
1
+ pluggy
2
+ tomli
3
+ testit-api-client==7.0.0.post530
@@ -1,3 +0,0 @@
1
- pluggy
2
- tomli
3
- testit-api-client==6.3.1.post540