testit-python-commons 3.3.0__tar.gz → 3.3.2__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.3.0 → testit_python_commons-3.3.2}/PKG-INFO +2 -2
  2. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/setup.py +2 -2
  3. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/client/api_client.py +22 -24
  4. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/client/converter.py +46 -16
  5. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/test_result.py +11 -0
  6. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  7. testit_python_commons-3.3.2/src/testit_python_commons.egg-info/requires.txt +2 -0
  8. testit_python_commons-3.3.0/src/testit_python_commons.egg-info/requires.txt +0 -2
  9. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/README.md +0 -0
  10. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/setup.cfg +0 -0
  11. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit.py +0 -0
  12. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/__init__.py +0 -0
  13. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/app_properties.py +0 -0
  14. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/client/__init__.py +0 -0
  15. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/client/client_configuration.py +0 -0
  16. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/decorators.py +0 -0
  17. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/dynamic_methods.py +0 -0
  18. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/__init__.py +0 -0
  19. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/adapter_mode.py +0 -0
  20. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/link.py +0 -0
  21. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/link_type.py +0 -0
  22. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/outcome_type.py +0 -0
  23. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/step_result.py +0 -0
  24. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  25. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/__init__.py +0 -0
  26. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/adapter_manager.py +0 -0
  27. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  28. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/logger.py +0 -0
  29. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/plugin_manager.py +0 -0
  30. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/retry.py +0 -0
  31. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/step_manager.py +0 -0
  32. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/step_result_storage.py +0 -0
  33. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/services/utils.py +0 -0
  34. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons/step.py +0 -0
  35. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
  36. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  37. {testit_python_commons-3.3.0 → testit_python_commons-3.3.2}/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.3.0
3
+ Version: 3.3.2
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.2.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.3.0',
5
+ version='3.3.2',
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.2.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
- WorkItemIdModel
11
+ WorkItemIdModel,
12
+ WorkItemIdentifierModel
12
13
  )
13
14
 
14
15
  from testit_python_commons.client.client_configuration import ClientConfiguration
@@ -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)
@@ -131,7 +131,7 @@ class ApiClientWorker:
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):
@@ -189,14 +189,10 @@ 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(
@@ -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,6 +2,7 @@ import typing
2
2
 
3
3
  from testit_api_client.models import (
4
4
  AttachmentPutModelAutoTestStepResultsModel,
5
+ AutoTestStepResultUpdateRequest,
5
6
  AutoTestPostModel,
6
7
  AutoTestPutModel,
7
8
  AutoTestResultsForTestRunModel,
@@ -11,11 +12,13 @@ from testit_api_client.models import (
11
12
  LinkPutModel,
12
13
  LinkType,
13
14
  TestRunV2PostShortModel,
14
- AutotestsSelectModelFilter,
15
- AutotestsSelectModelIncludes,
16
- ApiV2AutoTestsSearchPostRequest,
15
+ TestRunV2GetModel,
16
+ AutotestFilterModel,
17
+ SearchAutoTestsQueryIncludesModel,
18
+ AutotestsSelectModel,
17
19
  TestResultUpdateV2Request,
18
20
  TestResultModel,
21
+ TestResultV2GetModel,
19
22
  AttachmentModel,
20
23
  AttachmentUpdateRequest
21
24
  )
@@ -38,38 +41,38 @@ class Converter:
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
 
@@ -95,7 +98,8 @@ class Converter:
95
98
  description=test_result.get_description(),
96
99
  links=cls.links_to_links_post_model(test_result.get_links()),
97
100
  labels=test_result.get_labels(),
98
- should_create_work_item=test_result.get_automatic_creation_test_cases()
101
+ should_create_work_item=test_result.get_automatic_creation_test_cases(),
102
+ external_key=test_result.get_external_key()
99
103
  )
100
104
 
101
105
  @classmethod
@@ -120,7 +124,8 @@ class Converter:
120
124
  title=test_result.get_title(),
121
125
  description=test_result.get_description(),
122
126
  links=cls.links_to_links_put_model(test_result.get_links()),
123
- labels=test_result.get_labels()
127
+ labels=test_result.get_labels(),
128
+ external_key=test_result.get_external_key()
124
129
  )
125
130
  else:
126
131
  return AutoTestPutModel(
@@ -138,7 +143,8 @@ class Converter:
138
143
  title=test_result.get_title(),
139
144
  description=test_result.get_description(),
140
145
  links=cls.links_to_links_put_model(test_result.get_links()),
141
- labels=test_result.get_labels()
146
+ labels=test_result.get_labels(),
147
+ external_key=test_result.get_external_key()
142
148
  )
143
149
 
144
150
  @classmethod
@@ -324,3 +330,27 @@ class Converter:
324
330
  )
325
331
 
326
332
  return autotest_model_step_results
333
+
334
+ @classmethod
335
+ @adapter_logger
336
+ def step_results_to_auto_test_step_result_update_request(
337
+ cls, step_results: typing.List[StepResult]) -> typing.List[AutoTestStepResultUpdateRequest]:
338
+ autotest_model_step_results = []
339
+
340
+ for step_result in step_results:
341
+ autotest_model_step_results.append(
342
+ AutoTestStepResultUpdateRequest(
343
+ title=step_result.get_title(),
344
+ outcome=AvailableTestResultOutcome(step_result.get_outcome()),
345
+ description=step_result.get_description(),
346
+ duration=step_result.get_duration(),
347
+ parameters=step_result.get_parameters(),
348
+ attachments=step_result.get_attachments(),
349
+ started_on=step_result.get_started_on(),
350
+ completed_on=step_result.get_completed_on(),
351
+ step_results=cls.step_results_to_auto_test_step_result_update_request(
352
+ step_result.get_step_results())
353
+ )
354
+ )
355
+
356
+ return autotest_model_step_results
@@ -29,6 +29,7 @@ class TestResult:
29
29
  __parameters: dict = {}
30
30
  __properties: dict = {}
31
31
  __automatic_creation_test_cases: bool = False
32
+ __external_key: str = None
32
33
 
33
34
  @adapter_logger
34
35
  def set_external_id(self, external_id: str):
@@ -259,3 +260,13 @@ class TestResult:
259
260
  @adapter_logger
260
261
  def get_automatic_creation_test_cases(self) -> bool:
261
262
  return self.__automatic_creation_test_cases
263
+
264
+ @adapter_logger
265
+ def set_external_key(self, external_key: str):
266
+ self.__external_key = external_key
267
+
268
+ return self
269
+
270
+ @adapter_logger
271
+ def get_external_key(self) -> str:
272
+ return self.__external_key
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-python-commons
3
- Version: 3.3.0
3
+ Version: 3.3.2
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.2.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.2.0