testit-python-commons 3.2.6__tar.gz → 3.3.1__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 (37) hide show
  1. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/PKG-INFO +2 -2
  2. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/setup.py +2 -2
  3. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/client/api_client.py +27 -29
  4. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/client/converter.py +56 -29
  5. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  6. testit_python_commons-3.3.1/src/testit_python_commons.egg-info/requires.txt +2 -0
  7. testit_python_commons-3.2.6/src/testit_python_commons.egg-info/requires.txt +0 -2
  8. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/README.md +0 -0
  9. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/setup.cfg +0 -0
  10. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit.py +0 -0
  11. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/__init__.py +0 -0
  12. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/app_properties.py +0 -0
  13. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/client/__init__.py +0 -0
  14. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/client/client_configuration.py +0 -0
  15. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/decorators.py +0 -0
  16. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/dynamic_methods.py +0 -0
  17. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/__init__.py +0 -0
  18. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/adapter_mode.py +0 -0
  19. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/link.py +0 -0
  20. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/link_type.py +0 -0
  21. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/outcome_type.py +0 -0
  22. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/step_result.py +0 -0
  23. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/test_result.py +0 -0
  24. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  25. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/__init__.py +0 -0
  26. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/adapter_manager.py +0 -0
  27. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  28. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/logger.py +0 -0
  29. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/plugin_manager.py +0 -0
  30. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/retry.py +0 -0
  31. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/step_manager.py +0 -0
  32. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/step_result_storage.py +0 -0
  33. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/services/utils.py +0 -0
  34. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons/step.py +0 -0
  35. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
  36. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  37. {testit_python_commons-3.2.6 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-python-commons
3
- Version: 3.2.6
3
+ Version: 3.3.1
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: pluggy
19
- Requires-Dist: testit-api-client==4.0.0
19
+ Requires-Dist: testit-api-client==5.0.0
20
20
 
21
21
  # How to enable debug logging?
22
22
  1. Add in **connection_config.ini** file from the root directory of the project:
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name='testit-python-commons',
5
- version='3.2.6',
5
+ version='3.3.1',
6
6
  description='Python commons for Test IT',
7
7
  long_description=open('README.md', "r").read(),
8
8
  long_description_content_type="text/markdown",
@@ -23,5 +23,5 @@ setup(
23
23
  py_modules=['testit', 'testit_python_commons'],
24
24
  packages=find_packages(where='src'),
25
25
  package_dir={'': 'src'},
26
- install_requires=['pluggy', 'testit-api-client==4.0.0']
26
+ install_requires=['pluggy', 'testit-api-client==5.0.0']
27
27
  )
@@ -4,11 +4,12 @@ import typing
4
4
  from datetime import datetime
5
5
 
6
6
  from testit_api_client import ApiClient, Configuration
7
- from testit_api_client.apis import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi
7
+ from testit_api_client.api import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi
8
8
  from testit_api_client.models import (
9
9
  AttachmentPutModel,
10
10
  TestResultModel,
11
- LinkAutoTestToWorkItemRequest
11
+ WorkItemIdModel,
12
+ WorkItemIdentifierModel
12
13
  )
13
14
 
14
15
  from testit_python_commons.client.client_configuration import ClientConfiguration
@@ -60,7 +61,7 @@ class ApiClientWorker:
60
61
  test_run_name
61
62
  )
62
63
 
63
- response = self.__test_run_api.create_empty(create_empty_request=model)
64
+ response = self.__test_run_api.create_empty(test_run_v2_post_short_model=model)
64
65
 
65
66
  return Converter.get_id_from_create_test_run_response(response)
66
67
 
@@ -82,12 +83,12 @@ class ApiClientWorker:
82
83
  self.__config.get_project_id(),
83
84
  test_result.get_external_id())
84
85
 
85
- autotest = self.__autotest_api.api_v2_auto_tests_search_post(api_v2_auto_tests_search_post_request=model)
86
+ autotests = self.__autotest_api.api_v2_auto_tests_search_post(autotests_select_model=model)
86
87
 
87
- if autotest:
88
- self.__update_test(test_result, autotest[0]['is_flaky'])
88
+ if autotests:
89
+ self.__update_test(test_result, autotests[0].is_flaky)
89
90
 
90
- autotest_global_id = autotest[0]['id']
91
+ autotest_global_id = autotests[0].id
91
92
  else:
92
93
  autotest_global_id = self.__create_test(test_result)
93
94
 
@@ -97,16 +98,15 @@ class ApiClientWorker:
97
98
  return self.__load_test_result(test_result)
98
99
 
99
100
  @adapter_logger
100
- def __get_work_items_linked_to_autotest(self, autotest_global_id: str) -> list:
101
+ def __get_work_items_linked_to_autotest(self, autotest_global_id: str) -> typing.List[WorkItemIdentifierModel]:
101
102
  return self.__autotest_api.get_work_items_linked_to_auto_test(id=autotest_global_id)
102
103
 
103
104
  @adapter_logger
104
105
  def __update_autotest_link_from_work_items(self, autotest_global_id: str, work_item_ids: list):
105
-
106
106
  linked_work_items = self.__get_work_items_linked_to_autotest(autotest_global_id)
107
107
 
108
108
  for linked_work_item in linked_work_items:
109
- linked_work_item_id = str(linked_work_item['global_id'])
109
+ linked_work_item_id = str(linked_work_item.global_id)
110
110
 
111
111
  if linked_work_item_id in work_item_ids:
112
112
  work_item_ids.remove(linked_work_item_id)
@@ -127,11 +127,11 @@ class ApiClientWorker:
127
127
  test_result,
128
128
  self.__config.get_project_id())
129
129
 
130
- autotest_response = self.__autotest_api.create_auto_test(create_auto_test_request=model)
130
+ autotest_response = self.__autotest_api.create_auto_test(auto_test_post_model=model)
131
131
 
132
132
  logging.debug(f'Autotest "{test_result.get_autotest_name()}" was created')
133
133
 
134
- return autotest_response['id']
134
+ return autotest_response.id
135
135
 
136
136
  @adapter_logger
137
137
  def __update_test(self, test_result: TestResult, is_flaky: bool):
@@ -142,7 +142,7 @@ class ApiClientWorker:
142
142
  self.__config.get_project_id())
143
143
  model.is_flaky = is_flaky
144
144
 
145
- self.__autotest_api.update_auto_test(update_auto_test_request=model)
145
+ self.__autotest_api.update_auto_test(auto_test_put_model=model)
146
146
 
147
147
  logging.debug(f'Autotest "{test_result.get_autotest_name()}" was updated')
148
148
 
@@ -160,7 +160,7 @@ class ApiClientWorker:
160
160
  def __link_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
161
161
  self.__autotest_api.link_auto_test_to_work_item(
162
162
  autotest_global_id,
163
- link_auto_test_to_work_item_request=LinkAutoTestToWorkItemRequest(id=work_item_id))
163
+ work_item_id_model=WorkItemIdModel(id=work_item_id))
164
164
 
165
165
  logging.debug(f'Autotest was linked with workItem "{work_item_id}" by global id "{autotest_global_id}')
166
166
 
@@ -189,19 +189,15 @@ class ApiClientWorker:
189
189
  model = Converter.convert_test_result_model_to_test_results_id_put_request(
190
190
  self.get_test_result_by_id(test_result.get_test_result_id()))
191
191
 
192
- model.set_attribute(
193
- "setup_results",
194
- Converter.step_results_to_attachment_put_model_autotest_step_results_model(
195
- test_result.get_setup_results()))
196
- model.set_attribute(
197
- "teardown_results",
198
- Converter.step_results_to_attachment_put_model_autotest_step_results_model(
199
- test_result.get_teardown_results()))
192
+ model.setup_results = Converter.step_results_to_auto_test_step_result_update_request(
193
+ test_result.get_setup_results())
194
+ model.teardown_results = Converter.step_results_to_auto_test_step_result_update_request(
195
+ test_result.get_teardown_results())
200
196
 
201
197
  try:
202
198
  self.__test_results_api.api_v2_test_results_id_put(
203
199
  id=test_result.get_test_result_id(),
204
- api_v2_test_results_id_put_request=model)
200
+ test_result_update_v2_request=model)
205
201
  except Exception as exc:
206
202
  logging.error(f'Cannot update test result with id "{test_result.get_test_result_id()}" status: {exc}')
207
203
 
@@ -211,14 +207,16 @@ class ApiClientWorker:
211
207
 
212
208
  for path in attach_paths:
213
209
  if os.path.isfile(path):
214
- try:
215
- attachment_response = self.__attachments_api.api_v2_attachments_post(file=open(path, "rb"))
210
+ with open(path, "rb+") as file:
211
+ try:
212
+ attachment_response = self.__attachments_api.api_v2_attachments_post(
213
+ file=(file.name, file.read()))
216
214
 
217
- attachments.append(AttachmentPutModel(attachment_response['id']))
215
+ attachments.append(AttachmentPutModel(id=attachment_response.id))
218
216
 
219
- logging.debug(f'Attachment "{path}" was uploaded')
220
- except Exception as exc:
221
- logging.error(f'Upload attachment "{path}" status: {exc}')
217
+ logging.debug(f'Attachment "{path}" was uploaded')
218
+ except Exception as exc:
219
+ logging.error(f'Upload attachment "{path}" status: {exc}')
222
220
  else:
223
221
  logging.error(f'File "{path}" was not found!')
224
222
  return attachments
@@ -2,22 +2,25 @@ import typing
2
2
 
3
3
  from testit_api_client.models import (
4
4
  AttachmentPutModelAutoTestStepResultsModel,
5
- CreateAutoTestRequest,
6
- UpdateAutoTestRequest,
5
+ AutoTestStepResultUpdateRequest,
6
+ AutoTestPostModel,
7
+ AutoTestPutModel,
7
8
  AutoTestResultsForTestRunModel,
8
9
  AutoTestStepModel,
9
10
  AvailableTestResultOutcome,
10
11
  LinkPostModel,
11
12
  LinkPutModel,
12
13
  LinkType,
13
- CreateEmptyRequest,
14
- AutotestsSelectModelFilter,
15
- AutotestsSelectModelIncludes,
16
- ApiV2AutoTestsSearchPostRequest,
17
- ApiV2TestResultsIdPutRequest,
14
+ TestRunV2PostShortModel,
15
+ TestRunV2GetModel,
16
+ AutotestFilterModel,
17
+ SearchAutoTestsQueryIncludesModel,
18
+ AutotestsSelectModel,
19
+ TestResultUpdateV2Request,
18
20
  TestResultModel,
21
+ TestResultV2GetModel,
19
22
  AttachmentModel,
20
- AttachmentPutModel
23
+ AttachmentUpdateRequest
21
24
  )
22
25
 
23
26
  from testit_python_commons.models.link import Link
@@ -31,45 +34,45 @@ class Converter:
31
34
  @classmethod
32
35
  @adapter_logger
33
36
  def test_run_to_test_run_short_model(cls, project_id, name):
34
- return CreateEmptyRequest(
37
+ return TestRunV2PostShortModel(
35
38
  project_id=project_id,
36
39
  name=name
37
40
  )
38
41
 
39
42
  @classmethod
40
43
  @adapter_logger
41
- def get_id_from_create_test_run_response(cls, response):
42
- return response['id']
44
+ def get_id_from_create_test_run_response(cls, response: TestRunV2GetModel):
45
+ return response.id
43
46
 
44
47
  @classmethod
45
48
  @adapter_logger
46
- def get_resolved_autotests_from_get_test_run_response(cls, response, configuration: str):
47
- autotests = response['_data_store']['test_results']
49
+ def get_resolved_autotests_from_get_test_run_response(cls, response: TestRunV2GetModel, configuration: str):
50
+ autotests = response.test_results
48
51
 
49
52
  return cls.__get_resolved_autotests(autotests, configuration)
50
53
 
51
54
  @classmethod
52
55
  @adapter_logger
53
56
  def project_id_and_external_id_to_auto_tests_search_post_request(cls, project_id: str, external_id: str):
54
- autotests_filter = AutotestsSelectModelFilter(
57
+ autotests_filter = AutotestFilterModel(
55
58
  project_ids=[project_id],
56
59
  external_ids=[external_id],
57
60
  is_deleted=False)
58
- autotests_includes = AutotestsSelectModelIncludes(
61
+ autotests_includes = SearchAutoTestsQueryIncludesModel(
59
62
  include_steps=False,
60
63
  include_links=False,
61
64
  include_labels=False)
62
65
 
63
- return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
66
+ return AutotestsSelectModel(filter=autotests_filter, includes=autotests_includes)
64
67
 
65
68
  @staticmethod
66
69
  @adapter_logger
67
- def __get_resolved_autotests(autotests: list, configuration: str):
70
+ def __get_resolved_autotests(autotests: typing.List[TestResultV2GetModel], configuration: str):
68
71
  resolved_autotests = []
69
72
 
70
73
  for autotest in autotests:
71
- if configuration == autotest['_data_store']['configuration_id']:
72
- resolved_autotests.append(autotest._data_store['auto_test']._data_store['external_id'])
74
+ if configuration == autotest.configuration_id:
75
+ resolved_autotests.append(autotest.auto_test.external_id)
73
76
 
74
77
  return resolved_autotests
75
78
 
@@ -79,7 +82,7 @@ class Converter:
79
82
  cls,
80
83
  test_result: TestResult,
81
84
  project_id: str):
82
- return CreateAutoTestRequest(
85
+ return AutoTestPostModel(
83
86
  external_id=test_result.get_external_id(),
84
87
  project_id=project_id,
85
88
  name=test_result.get_autotest_name(),
@@ -105,7 +108,7 @@ class Converter:
105
108
  test_result: TestResult,
106
109
  project_id: str):
107
110
  if test_result.get_outcome() == 'Passed':
108
- return UpdateAutoTestRequest(
111
+ return AutoTestPutModel(
109
112
  external_id=test_result.get_external_id(),
110
113
  project_id=project_id,
111
114
  name=test_result.get_autotest_name(),
@@ -123,7 +126,7 @@ class Converter:
123
126
  labels=test_result.get_labels()
124
127
  )
125
128
  else:
126
- return UpdateAutoTestRequest(
129
+ return AutoTestPutModel(
127
130
  external_id=test_result.get_external_id(),
128
131
  project_id=project_id,
129
132
  name=test_result.get_autotest_name(),
@@ -173,8 +176,8 @@ class Converter:
173
176
  @adapter_logger
174
177
  def convert_test_result_model_to_test_results_id_put_request(
175
178
  cls,
176
- test_result: TestResultModel) -> ApiV2TestResultsIdPutRequest:
177
- return ApiV2TestResultsIdPutRequest(
179
+ test_result: TestResultModel) -> TestResultUpdateV2Request:
180
+ return TestResultUpdateV2Request(
178
181
  failure_class_ids=test_result.failure_class_ids,
179
182
  outcome=test_result.outcome,
180
183
  comment=test_result.comment,
@@ -192,8 +195,8 @@ class Converter:
192
195
  @adapter_logger
193
196
  def convert_test_result_with_all_setup_and_teardown_steps_to_test_results_id_put_request(
194
197
  cls,
195
- test_result: TestResultWithAllFixtureStepResults) -> ApiV2TestResultsIdPutRequest:
196
- return ApiV2TestResultsIdPutRequest(
198
+ test_result: TestResultWithAllFixtureStepResults) -> TestResultUpdateV2Request:
199
+ return TestResultUpdateV2Request(
197
200
  setup_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
198
201
  test_result.get_setup_results()),
199
202
  teardown_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
@@ -269,7 +272,7 @@ class Converter:
269
272
  @classmethod
270
273
  @adapter_logger
271
274
  def attachment_models_to_attachment_put_models(
272
- cls, attachments: typing.List[AttachmentModel]) -> typing.List[AttachmentPutModel]:
275
+ cls, attachments: typing.List[AttachmentModel]) -> typing.List[AttachmentUpdateRequest]:
273
276
  put_model_attachments = []
274
277
 
275
278
  for attachment in attachments:
@@ -281,8 +284,8 @@ class Converter:
281
284
 
282
285
  @staticmethod
283
286
  @adapter_logger
284
- def attachment_model_to_attachment_put_model(attachment: AttachmentModel) -> AttachmentPutModel:
285
- return AttachmentPutModel(id=attachment.id)
287
+ def attachment_model_to_attachment_put_model(attachment: AttachmentModel) -> AttachmentUpdateRequest:
288
+ return AttachmentUpdateRequest(id=attachment.id)
286
289
 
287
290
  @classmethod
288
291
  # @adapter_logger
@@ -324,3 +327,27 @@ class Converter:
324
327
  )
325
328
 
326
329
  return autotest_model_step_results
330
+
331
+ @classmethod
332
+ @adapter_logger
333
+ def step_results_to_auto_test_step_result_update_request(
334
+ cls, step_results: typing.List[StepResult]) -> typing.List[AutoTestStepResultUpdateRequest]:
335
+ autotest_model_step_results = []
336
+
337
+ for step_result in step_results:
338
+ autotest_model_step_results.append(
339
+ AutoTestStepResultUpdateRequest(
340
+ title=step_result.get_title(),
341
+ outcome=AvailableTestResultOutcome(step_result.get_outcome()),
342
+ description=step_result.get_description(),
343
+ duration=step_result.get_duration(),
344
+ parameters=step_result.get_parameters(),
345
+ attachments=step_result.get_attachments(),
346
+ started_on=step_result.get_started_on(),
347
+ completed_on=step_result.get_completed_on(),
348
+ step_results=cls.step_results_to_auto_test_step_result_update_request(
349
+ step_result.get_step_results())
350
+ )
351
+ )
352
+
353
+ return autotest_model_step_results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-python-commons
3
- Version: 3.2.6
3
+ Version: 3.3.1
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: pluggy
19
- Requires-Dist: testit-api-client==4.0.0
19
+ Requires-Dist: testit-api-client==5.0.0
20
20
 
21
21
  # How to enable debug logging?
22
22
  1. Add in **connection_config.ini** file from the root directory of the project:
@@ -0,0 +1,2 @@
1
+ pluggy
2
+ testit-api-client==5.0.0
@@ -1,2 +0,0 @@
1
- pluggy
2
- testit-api-client==4.0.0