testit-python-commons 4.0.0__tar.gz → 4.1.0.post570__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 (79) hide show
  1. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/PKG-INFO +2 -2
  2. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/setup.py +2 -2
  3. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/test_result_cut_api_model.py +8 -0
  4. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/api_client.py +36 -6
  5. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/converter.py +50 -84
  6. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/decorators.py +31 -0
  7. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/dynamic_methods.py +48 -9
  8. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/link_type.py +3 -0
  9. testit_python_commons-4.1.0.post570/src/testit_python_commons/models/status_type.py +6 -0
  10. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/test_result.py +11 -0
  11. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/adapter_manager.py +5 -1
  12. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/sync_storage/sync_storage_runner.py +5 -3
  13. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/utils/html_escape_utils.py +6 -1
  14. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  15. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons.egg-info/SOURCES.txt +1 -0
  16. testit_python_commons-4.1.0.post570/src/testit_python_commons.egg-info/requires.txt +3 -0
  17. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/tests/test_html_escape_utils.py +20 -0
  18. testit_python_commons-4.0.0/src/testit_python_commons.egg-info/requires.txt +0 -3
  19. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/README.md +0 -0
  20. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/setup.cfg +0 -0
  21. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/__init__.py +0 -0
  22. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/__init__.py +0 -0
  23. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/completion_api.py +0 -0
  24. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/health_api.py +0 -0
  25. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/system_api.py +0 -0
  26. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/test_results_api.py +0 -0
  27. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api/workers_api.py +0 -0
  28. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/api_client.py +0 -0
  29. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/apis/__init__.py +0 -0
  30. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/configuration.py +0 -0
  31. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/exceptions.py +0 -0
  32. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/__init__.py +0 -0
  33. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/health_status_response.py +0 -0
  34. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/register_request.py +0 -0
  35. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/register_response.py +0 -0
  36. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/set_worker_status_request.py +0 -0
  37. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/set_worker_status_response.py +0 -0
  38. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/shutdown_response.py +0 -0
  39. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model/test_result_save_response.py +0 -0
  40. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/model_utils.py +0 -0
  41. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/models/__init__.py +0 -0
  42. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/api_client_syncstorage/rest.py +0 -0
  43. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit.py +0 -0
  44. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/__init__.py +0 -0
  45. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/app_properties.py +0 -0
  46. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/__init__.py +0 -0
  47. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/client_configuration.py +0 -0
  48. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/helpers/__init__.py +0 -0
  49. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/helpers/bulk_autotest_helper.py +0 -0
  50. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/helpers/threads_manager.py +0 -0
  51. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/models/__init__.py +0 -0
  52. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/models/threads_for_create_and_result.py +0 -0
  53. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/client/models/threads_for_update_and_result.py +0 -0
  54. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/configurations/__init__.py +0 -0
  55. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/configurations/properties_names.py +0 -0
  56. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/__init__.py +0 -0
  57. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/adapter_mode.py +0 -0
  58. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/fixture.py +0 -0
  59. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/link.py +0 -0
  60. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/outcome_type.py +0 -0
  61. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/step_result.py +0 -0
  62. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  63. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/__init__.py +0 -0
  64. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  65. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/fixture_manager.py +0 -0
  66. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/fixture_storage.py +0 -0
  67. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/logger.py +0 -0
  68. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/plugin_manager.py +0 -0
  69. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/retry.py +0 -0
  70. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/step_manager.py +0 -0
  71. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/step_result_storage.py +0 -0
  72. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/sync_storage/__init__.py +0 -0
  73. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/services/utils.py +0 -0
  74. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/step.py +0 -0
  75. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons/utils/__init__.py +0 -0
  76. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  77. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/src/testit_python_commons.egg-info/top_level.txt +0 -0
  78. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/tests/test_app_properties.py +0 -0
  79. {testit_python_commons-4.0.0 → testit_python_commons-4.1.0.post570}/tests/test_dynamic_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 4.0.0
3
+ Version: 4.1.0.post570
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.5.3
20
+ Requires-Dist: testit-api-client==7.5.5.post570
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 = "4.0.0"
3
+ VERSION = "4.1.0.post570"
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.5.3']
28
+ install_requires=['pluggy', 'tomli', 'testit-api-client==7.5.5.post570']
29
29
  )
@@ -81,8 +81,10 @@ class TestResultCutApiModel(ModelNormal):
81
81
  and the value is attribute type.
82
82
  """
83
83
  return {
84
+ 'project_id': (str,), # noqa: E501
84
85
  'auto_test_external_id': (str,), # noqa: E501
85
86
  'status_code': (str,), # noqa: E501
87
+ 'status_type': (str,), # noqa: E501
86
88
  'started_on': (datetime, none_type,), # noqa: E501
87
89
  }
88
90
 
@@ -92,8 +94,10 @@ class TestResultCutApiModel(ModelNormal):
92
94
 
93
95
 
94
96
  attribute_map = {
97
+ 'project_id': 'projectId', # noqa: E501
95
98
  'auto_test_external_id': 'autoTestExternalId', # noqa: E501
96
99
  'status_code': 'statusCode', # noqa: E501
100
+ 'status_type': 'statusType', # noqa: E501
97
101
  'started_on': 'startedOn', # noqa: E501
98
102
  }
99
103
 
@@ -138,8 +142,10 @@ class TestResultCutApiModel(ModelNormal):
138
142
  Animal class but this time we won't travel
139
143
  through its discriminator because we passed in
140
144
  _visited_composed_classes = (Animal,)
145
+ project_id (str): [optional] # noqa: E501
141
146
  auto_test_external_id (str): [optional] # noqa: E501
142
147
  status_code (str): [optional] # noqa: E501
148
+ status_type (str): [optional] # noqa: E501
143
149
  started_on (datetime, none_type): [optional] # noqa: E501
144
150
  """
145
151
 
@@ -226,8 +232,10 @@ class TestResultCutApiModel(ModelNormal):
226
232
  Animal class but this time we won't travel
227
233
  through its discriminator because we passed in
228
234
  _visited_composed_classes = (Animal,)
235
+ project_id (str): [optional] # noqa: E501
229
236
  auto_test_external_id (str): [optional] # noqa: E501
230
237
  status_code (str): [optional] # noqa: E501
238
+ status_type (str): [optional] # noqa: E501
231
239
  started_on (datetime, none_type): [optional] # noqa: E501
232
240
  """
233
241
 
@@ -3,7 +3,15 @@ import os
3
3
  from datetime import datetime
4
4
 
5
5
  from testit_api_client import ApiClient, Configuration
6
- from testit_api_client.apis import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi, WorkItemsApi
6
+ from testit_api_client.apis import (
7
+ AttachmentsApi,
8
+ AutoTestsApi,
9
+ TestRunsApi,
10
+ TestResultsApi,
11
+ WorkItemsApi,
12
+ ProjectsApi,
13
+ WorkflowsApi,
14
+ )
7
15
  from testit_api_client.models import (
8
16
  ApiV2TestResultsSearchPostRequest,
9
17
  AutoTestApiResult,
@@ -15,6 +23,8 @@ from testit_api_client.models import (
15
23
  TestRunV2ApiResult,
16
24
  LinkAutoTestToWorkItemRequest,
17
25
  AutoTestWorkItemIdentifierApiResult,
26
+ ProjectModel,
27
+ WorkflowApiResult,
18
28
  )
19
29
 
20
30
  from testit_python_commons.client.client_configuration import ClientConfiguration
@@ -41,7 +51,10 @@ class ApiClientWorker:
41
51
  self.__attachments_api = AttachmentsApi(api_client=api_client)
42
52
  self.__test_results_api = TestResultsApi(api_client=api_client)
43
53
  self.__work_items_api = WorkItemsApi(api_client=api_client)
54
+ self.__projects_api = ProjectsApi(api_client=api_client)
55
+ self.__workflows_api = WorkflowsApi(api_client=api_client)
44
56
  self.__config = config
57
+ self.__status_codes = self.__get_status_codes()
45
58
 
46
59
  @staticmethod
47
60
  @adapter_logger
@@ -179,7 +192,8 @@ class ApiClientWorker:
179
192
 
180
193
  test_result_model = Converter.test_result_to_testrun_result_post_model(
181
194
  test_result,
182
- self.__config.get_configuration_id())
195
+ self.__config.get_configuration_id(),
196
+ self.__status_codes)
183
197
 
184
198
  work_item_ids_for_link_with_auto_test = self.__get_work_item_uuids_for_link_with_auto_test(
185
199
  test_result.get_work_item_ids())
@@ -385,7 +399,8 @@ class ApiClientWorker:
385
399
  def __load_test_result(self, test_result: TestResult) -> str:
386
400
  model = Converter.test_result_to_testrun_result_post_model(
387
401
  test_result,
388
- self.__config.get_configuration_id())
402
+ self.__config.get_configuration_id(),
403
+ self.__status_codes)
389
404
 
390
405
  response = self.__test_run_api.set_auto_test_results_for_test_run(
391
406
  id=self.__config.get_test_run_id(),
@@ -407,8 +422,8 @@ class ApiClientWorker:
407
422
  fixtures_containers, test_result_ids)
408
423
 
409
424
  for test_result in test_results:
410
- model = Converter.convert_test_result_model_to_test_results_id_put_request(
411
- self.get_test_result_by_id(test_result.get_test_result_id()))
425
+ test_result_response = self.get_test_result_by_id(test_result.get_test_result_id())
426
+ model = Converter.convert_test_result_model_to_test_results_id_put_request(test_result_response)
412
427
 
413
428
  model.setup_results = Converter.step_results_to_auto_test_step_result_update_request(
414
429
  test_result.get_setup_results())
@@ -441,4 +456,19 @@ class ApiClientWorker:
441
456
  return attachments
442
457
 
443
458
  def get_configuration_id(self):
444
- return self.__config.get_configuration_id()
459
+ return self.__config.get_configuration_id()
460
+
461
+ @adapter_logger
462
+ def __get_project(self) -> ProjectModel:
463
+ return self.__projects_api.get_project_by_id(id=self.__config.get_project_id())
464
+
465
+ @adapter_logger
466
+ def __get_workflow_by_id(self, workflow_id: str) -> WorkflowApiResult:
467
+ return self.__workflows_api.api_v2_workflows_id_get(id=workflow_id)
468
+
469
+ @adapter_logger
470
+ def __get_status_codes(self) -> List[str]:
471
+ project: ProjectModel = self.__get_project()
472
+ workflow: WorkflowApiResult = self.__get_workflow_by_id(project.workflow_id)
473
+
474
+ return [status.code for status in workflow.statuses]
@@ -32,6 +32,8 @@ from testit_api_client.models import (
32
32
  LinkApiResult,
33
33
  UpdateLinkApiModel,
34
34
  AssignAttachmentApiModel,
35
+ TestStatusType,
36
+ TestStatusApiType,
35
37
  )
36
38
 
37
39
  from testit_python_commons.models.link import Link
@@ -109,7 +111,7 @@ class Converter:
109
111
  return ApiV2TestResultsSearchPostRequest(
110
112
  test_run_ids=[testrun_id],
111
113
  configuration_ids=[configuration_id],
112
- status_codes=["InProgress"])
114
+ status_types=[TestStatusApiType("InProgress")])
113
115
 
114
116
  @staticmethod
115
117
  @adapter_logger
@@ -197,46 +199,25 @@ class Converter:
197
199
  cls,
198
200
  test_result: TestResult,
199
201
  project_id: str) -> AutoTestUpdateApiModel:
200
- if test_result.get_outcome() == 'Passed':
201
- return AutoTestUpdateApiModel(
202
- external_id=test_result.get_external_id(),
203
- project_id=project_id,
204
- name=test_result.get_autotest_name(),
205
- steps=cls.step_results_to_autotest_steps_model(
206
- test_result.get_step_results()),
207
- setup=cls.step_results_to_autotest_steps_model(
208
- test_result.get_setup_results()),
209
- teardown=cls.step_results_to_autotest_steps_model(
210
- test_result.get_teardown_results()),
211
- namespace=test_result.get_namespace(),
212
- classname=test_result.get_classname(),
213
- title=test_result.get_title(),
214
- description=test_result.get_description(),
215
- links=cls.links_to_links_put_model(test_result.get_links()),
216
- labels=test_result.get_labels(),
217
- tags=test_result.get_tags(),
218
- external_key=test_result.get_external_key()
219
- )
220
- else:
221
- return AutoTestUpdateApiModel(
222
- external_id=test_result.get_external_id(),
223
- project_id=project_id,
224
- name=test_result.get_autotest_name(),
225
- steps=cls.step_results_to_autotest_steps_model(
226
- test_result.get_step_results()),
227
- setup=cls.step_results_to_autotest_steps_model(
228
- test_result.get_setup_results()),
229
- teardown=cls.step_results_to_autotest_steps_model(
230
- test_result.get_teardown_results()),
231
- namespace=test_result.get_namespace(),
232
- classname=test_result.get_classname(),
233
- title=test_result.get_title(),
234
- description=test_result.get_description(),
235
- links=cls.links_to_links_put_model(test_result.get_links()),
236
- labels=test_result.get_labels(),
237
- tags=test_result.get_tags(),
238
- external_key=test_result.get_external_key()
239
- )
202
+ return AutoTestUpdateApiModel(
203
+ external_id=test_result.get_external_id(),
204
+ project_id=project_id,
205
+ name=test_result.get_autotest_name(),
206
+ steps=cls.step_results_to_autotest_steps_model(
207
+ test_result.get_step_results()),
208
+ setup=cls.step_results_to_autotest_steps_model(
209
+ test_result.get_setup_results()),
210
+ teardown=cls.step_results_to_autotest_steps_model(
211
+ test_result.get_teardown_results()),
212
+ namespace=test_result.get_namespace(),
213
+ classname=test_result.get_classname(),
214
+ title=test_result.get_title(),
215
+ description=test_result.get_description(),
216
+ links=cls.links_to_links_put_model(test_result.get_links()),
217
+ labels=test_result.get_labels(),
218
+ tags=test_result.get_tags(),
219
+ external_key=test_result.get_external_key()
220
+ )
240
221
 
241
222
  @classmethod
242
223
  @adapter_logger
@@ -244,57 +225,37 @@ class Converter:
244
225
  cls,
245
226
  test_result: TestResult,
246
227
  project_id: str) -> UpdateAutoTestRequest:
247
- if test_result.get_outcome() == 'Passed':
248
- return UpdateAutoTestRequest(
249
- external_id=test_result.get_external_id(),
250
- project_id=project_id,
251
- name=test_result.get_autotest_name(),
252
- steps=cls.step_results_to_autotest_steps_model(
253
- test_result.get_step_results()),
254
- setup=cls.step_results_to_autotest_steps_model(
255
- test_result.get_setup_results()),
256
- teardown=cls.step_results_to_autotest_steps_model(
257
- test_result.get_teardown_results()),
258
- namespace=test_result.get_namespace(),
259
- classname=test_result.get_classname(),
260
- title=test_result.get_title(),
261
- description=test_result.get_description(),
262
- links=cls.links_to_links_put_model(test_result.get_links()),
263
- labels=test_result.get_labels(),
264
- tags=test_result.get_tags(),
265
- external_key=test_result.get_external_key()
266
- )
267
- else:
268
- return UpdateAutoTestRequest(
269
- external_id=test_result.get_external_id(),
270
- project_id=project_id,
271
- name=test_result.get_autotest_name(),
272
- steps=cls.step_results_to_autotest_steps_model(
273
- test_result.get_step_results()),
274
- setup=cls.step_results_to_autotest_steps_model(
275
- test_result.get_setup_results()),
276
- teardown=cls.step_results_to_autotest_steps_model(
277
- test_result.get_teardown_results()),
278
- namespace=test_result.get_namespace(),
279
- classname=test_result.get_classname(),
280
- title=test_result.get_title(),
281
- description=test_result.get_description(),
282
- links=cls.links_to_links_put_model(test_result.get_links()),
283
- labels=test_result.get_labels(),
284
- tags=test_result.get_tags(),
285
- external_key=test_result.get_external_key()
286
- )
228
+ return UpdateAutoTestRequest(
229
+ external_id=test_result.get_external_id(),
230
+ project_id=project_id,
231
+ name=test_result.get_autotest_name(),
232
+ steps=cls.step_results_to_autotest_steps_model(
233
+ test_result.get_step_results()),
234
+ setup=cls.step_results_to_autotest_steps_model(
235
+ test_result.get_setup_results()),
236
+ teardown=cls.step_results_to_autotest_steps_model(
237
+ test_result.get_teardown_results()),
238
+ namespace=test_result.get_namespace(),
239
+ classname=test_result.get_classname(),
240
+ title=test_result.get_title(),
241
+ description=test_result.get_description(),
242
+ links=cls.links_to_links_put_model(test_result.get_links()),
243
+ labels=test_result.get_labels(),
244
+ tags=test_result.get_tags(),
245
+ external_key=test_result.get_external_key()
246
+ )
287
247
 
288
248
  @classmethod
289
249
  @adapter_logger
290
250
  def test_result_to_testrun_result_post_model(
291
251
  cls,
292
252
  test_result: TestResult,
293
- configuration_id: str) -> AutoTestResultsForTestRunModel:
294
- return AutoTestResultsForTestRunModel(
253
+ configuration_id: str,
254
+ status_codes: List[str]) -> AutoTestResultsForTestRunModel:
255
+ model = AutoTestResultsForTestRunModel(
295
256
  configuration_id=configuration_id,
296
257
  auto_test_external_id=test_result.get_external_id(),
297
- status_code=test_result.get_outcome(),
258
+ status_type=TestStatusType(test_result.get_status_type()),
298
259
  step_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
299
260
  test_result.get_step_results()),
300
261
  setup_results=cls.step_results_to_attachment_put_model_autotest_step_results_model(
@@ -313,6 +274,11 @@ class Converter:
313
274
  completed_on=test_result.get_completed_on()
314
275
  )
315
276
 
277
+ if test_result.get_outcome().upper() in status_codes:
278
+ model.status_code = test_result.get_outcome()
279
+
280
+ return model
281
+
316
282
  @classmethod
317
283
  @adapter_logger
318
284
  def convert_test_result_model_to_test_results_id_put_request(
@@ -51,6 +51,9 @@ def workItemID(*test_workitems_id: int or str): # noqa: N802
51
51
 
52
52
  @adapter_logger
53
53
  def workItemIds(*test_workitems_id: int or str): # noqa: N802
54
+ """
55
+ specifies a method that links autotests with manual tests. Receives the array of manual tests' IDs
56
+ """
54
57
  def outer(function): # noqa: N802
55
58
  function.test_workitems_id = []
56
59
  for test_workitem_id in test_workitems_id:
@@ -62,6 +65,9 @@ def workItemIds(*test_workitems_id: int or str): # noqa: N802
62
65
 
63
66
  @adapter_logger
64
67
  def displayName(test_displayname: str): # noqa: N802
68
+ """
69
+ specifies internal autotest name (used in Test IT)
70
+ """
65
71
  def outer(function):
66
72
  function.test_displayname = test_displayname
67
73
  return inner(function)
@@ -71,6 +77,9 @@ def displayName(test_displayname: str): # noqa: N802
71
77
 
72
78
  @adapter_logger
73
79
  def nameSpace(test_namespace: str): # noqa: N802
80
+ """
81
+ specifies directory in the TMS system (default - file's name of test)
82
+ """
74
83
  def outer(function):
75
84
  function.test_namespace = test_namespace
76
85
  return inner(function)
@@ -80,6 +89,9 @@ def nameSpace(test_namespace: str): # noqa: N802
80
89
 
81
90
  @adapter_logger
82
91
  def className(test_classname: str): # noqa: N802
92
+ """
93
+ specifies subdirectory in the TMS system (default - class's name of test)
94
+ """
83
95
  def outer(function):
84
96
  function.test_classname = test_classname
85
97
  return inner(function)
@@ -99,6 +111,9 @@ def externalID(test_external_id: str): # noqa: N802
99
111
 
100
112
  @adapter_logger
101
113
  def externalId(test_external_id: str): # noqa: N802
114
+ """
115
+ specifies unique internal autotest ID (used in Test IT)
116
+ """
102
117
  def outer(function):
103
118
  function.test_external_id = test_external_id
104
119
  return inner(function)
@@ -108,6 +123,10 @@ def externalId(test_external_id: str): # noqa: N802
108
123
 
109
124
  @adapter_logger
110
125
  def title(test_title: str):
126
+ """
127
+ specifies autotest name specified in the autotest card.
128
+ If not specified, the name from the displayName method is used
129
+ """
111
130
  def outer(function):
112
131
  function.test_title = test_title
113
132
  return inner(function)
@@ -117,6 +136,9 @@ def title(test_title: str):
117
136
 
118
137
  @adapter_logger
119
138
  def description(test_description: str):
139
+ """
140
+ specifies autotest description specified in the autotest card
141
+ """
120
142
  def outer(function):
121
143
  function.test_description = test_description
122
144
  return inner(function)
@@ -127,6 +149,9 @@ def description(test_description: str):
127
149
  @Utils.deprecated('Use "tags" instead.')
128
150
  @adapter_logger
129
151
  def labels(*test_labels: str):
152
+ """
153
+ specifies labels listed in the autotest card
154
+ """
130
155
  def outer(function):
131
156
  function.test_labels = test_labels
132
157
  return inner(function)
@@ -136,6 +161,9 @@ def labels(*test_labels: str):
136
161
 
137
162
  @adapter_logger
138
163
  def tags(*test_tags: str):
164
+ """
165
+ specifies tags listed in the autotest card
166
+ """
139
167
  def outer(function):
140
168
  function.test_tags = test_tags
141
169
  return inner(function)
@@ -165,6 +193,9 @@ def link(url: str, title: str = None, type: str = None, description: str = None)
165
193
  @adapter_logger
166
194
  def links(url: str = None, title: str = None, type: str = None, # noqa: A002,VNE003
167
195
  description: str = None, links: list or tuple = None):
196
+ """
197
+ specifies links listed in the autotest card
198
+ """
168
199
  def outer(function):
169
200
  if not hasattr(function, 'test_links'):
170
201
  function.test_links = []
@@ -21,6 +21,9 @@ def addLink(url: str, title: str = None, type: str = None, description: str = No
21
21
  @adapter_logger
22
22
  def addLinks(url: str = None, title: str = None, type: str = None, description: str = None, # noqa: A002,VNE003,N802
23
23
  links: list or tuple = None):
24
+ """
25
+ links in the autotest result
26
+ """
24
27
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_link'):
25
28
  if url:
26
29
  TmsPluginManager.get_plugin_manager().hook \
@@ -51,6 +54,9 @@ def message(test_message: str):
51
54
 
52
55
  @adapter_logger
53
56
  def addMessage(test_message: str): # noqa: N802
57
+ """
58
+ information about autotest in the autotest result
59
+ """
54
60
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_message'):
55
61
  TmsPluginManager.get_plugin_manager().hook \
56
62
  .add_message(test_message=test_message)
@@ -73,16 +79,19 @@ def attachments(*attachments_paths):
73
79
 
74
80
  @adapter_logger
75
81
  def addAttachments(data, is_text: bool = False, name: str = None): # noqa: N802
82
+ """
83
+ uploading files in the autotest result
84
+ """
76
85
  active_step = TmsPluginManager.get_step_manager().get_active_step()
77
86
 
78
87
  if active_step:
79
- add_attachments_to_step(active_step, data, is_text, name)
88
+ __add_attachments_to_step(active_step, data, is_text, name)
80
89
  else:
81
- add_attachments_to_test(data, is_text, name)
90
+ __add_attachments_to_test(data, is_text, name)
82
91
 
83
92
 
84
93
  @adapter_logger
85
- def add_attachments_to_step(step, data, is_text: bool = False, name: str = None):
94
+ def __add_attachments_to_step(step, data, is_text: bool = False, name: str = None):
86
95
  if is_text:
87
96
  attachment_ids = TmsPluginManager.get_adapter_manager().create_attachment(data, name)
88
97
  else:
@@ -98,7 +107,7 @@ def add_attachments_to_step(step, data, is_text: bool = False, name: str = None)
98
107
 
99
108
 
100
109
  @adapter_logger
101
- def add_attachments_to_test(data, is_text: bool = False, name: str = None):
110
+ def __add_attachments_to_test(data, is_text: bool = False, name: str = None):
102
111
  if is_text and hasattr(TmsPluginManager.get_plugin_manager().hook, 'create_attachment'):
103
112
  TmsPluginManager.get_plugin_manager().hook \
104
113
  .create_attachment(
@@ -117,6 +126,9 @@ def add_attachments_to_test(data, is_text: bool = False, name: str = None):
117
126
 
118
127
  @adapter_logger
119
128
  def addWorkItemIds(*test_work_item_ids: int or str): # noqa: N802
129
+ """
130
+ a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
131
+ """
120
132
  if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_work_item_id'):
121
133
  return
122
134
 
@@ -126,6 +138,9 @@ def addWorkItemIds(*test_work_item_ids: int or str): # noqa: N802
126
138
 
127
139
  @adapter_logger
128
140
  def addDisplayName(test_display_name: str): # noqa: N802
141
+ """
142
+ a dynamic method for adding internal autotest name (used in Test IT)
143
+ """
129
144
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_display_name'):
130
145
  TmsPluginManager.get_plugin_manager().hook \
131
146
  .add_display_name(test_display_name=str(test_display_name))
@@ -133,6 +148,9 @@ def addDisplayName(test_display_name: str): # noqa: N802
133
148
 
134
149
  @adapter_logger
135
150
  def addNameSpace(test_namespace: str): # noqa: N802
151
+ """
152
+ a dynamic method for adding directory in the TMS system (default - file's name of test)
153
+ """
136
154
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_namespace'):
137
155
  TmsPluginManager.get_plugin_manager().hook \
138
156
  .add_namespace(test_namespace=str(test_namespace))
@@ -140,6 +158,9 @@ def addNameSpace(test_namespace: str): # noqa: N802
140
158
 
141
159
  @adapter_logger
142
160
  def addClassName(test_classname: str): # noqa: N802
161
+ """
162
+ a dynamic method for adding subdirectory in the TMS system (default - class's name of test)
163
+ """
143
164
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_classname'):
144
165
  TmsPluginManager.get_plugin_manager().hook \
145
166
  .add_classname(test_classname=str(test_classname))
@@ -147,20 +168,29 @@ def addClassName(test_classname: str): # noqa: N802
147
168
 
148
169
  @adapter_logger
149
170
  def addExternalId(test_external_id: str): # noqa: N802
171
+ """
172
+ a dynamic method for adding unique internal autotest ID (used in Test IT)
173
+ """
150
174
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_external_id'):
151
175
  TmsPluginManager.get_plugin_manager().hook \
152
176
  .add_external_id(test_external_id=str(test_external_id))
153
177
 
154
178
 
155
179
  @adapter_logger
156
- def addTitle(test_title: str):
180
+ def addTitle(test_title: str): # noqa: N802
181
+ """
182
+ a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
183
+ """
157
184
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_title'):
158
185
  TmsPluginManager.get_plugin_manager().hook \
159
186
  .add_title(test_title=str(test_title))
160
187
 
161
188
 
162
189
  @adapter_logger
163
- def addDescription(test_description: str):
190
+ def addDescription(test_description: str): # noqa: N802
191
+ """
192
+ a dynamic method for adding autotest description specified in the autotest card
193
+ """
164
194
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_description'):
165
195
  TmsPluginManager.get_plugin_manager().hook \
166
196
  .add_description(test_description=str(test_description))
@@ -168,7 +198,10 @@ def addDescription(test_description: str):
168
198
 
169
199
  @Utils.deprecated('Use "addTags" instead.')
170
200
  @adapter_logger
171
- def addLabels(*test_labels: str):
201
+ def addLabels(*test_labels: str): # noqa: N802
202
+ """
203
+ a dynamic method for adding labels listed in the autotest card
204
+ """
172
205
  if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_label'):
173
206
  return
174
207
 
@@ -177,7 +210,10 @@ def addLabels(*test_labels: str):
177
210
 
178
211
 
179
212
  @adapter_logger
180
- def addTags(*test_tags: str):
213
+ def addTags(*test_tags: str): # noqa: N802
214
+ """
215
+ a dynamic method for adding tags listed in the autotest card
216
+ """
181
217
  if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_tag'):
182
218
  return
183
219
 
@@ -186,7 +222,10 @@ def addTags(*test_tags: str):
186
222
 
187
223
 
188
224
  @adapter_logger
189
- def addParameter(name: str, value: str):
225
+ def addParameter(name: str, value: str): # noqa: N802
226
+ """
227
+ a dynamic method for adding parameter in the autotest result
228
+ """
190
229
  if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_parameter'):
191
230
  TmsPluginManager.get_plugin_manager().hook \
192
231
  .add_parameter(name=str(name), value=str(value))
@@ -1,4 +1,7 @@
1
1
  class LinkType:
2
+ """
3
+ Test IT link type
4
+ """
2
5
  RELATED = 'Related'
3
6
  BLOCKED_BY = 'BlockedBy'
4
7
  DEFECT = 'Defect'
@@ -0,0 +1,6 @@
1
+ class StatusType:
2
+ SUCCEEDED = 'Succeeded'
3
+ FAILED = 'Failed'
4
+ INCOMPLETE = 'Incomplete'
5
+ INPROGRESS = 'InProgress'
6
+ PENDING = 'Pending'
@@ -10,6 +10,7 @@ class TestResult:
10
10
  __external_id: str = None
11
11
  __autotest_name: str = None
12
12
  __outcome: str = None
13
+ __status_type: str = None
13
14
  __title: str = None
14
15
  __description: str = None
15
16
  __duration: int = None
@@ -65,6 +66,16 @@ class TestResult:
65
66
  def get_outcome(self) -> str:
66
67
  return self.__outcome
67
68
 
69
+ @adapter_logger
70
+ def set_status_type(self, status_type: str):
71
+ self.__status_type = HtmlEscapeUtils.escape_html_tags(status_type)
72
+
73
+ return self
74
+
75
+ @adapter_logger
76
+ def get_status_type(self) -> str:
77
+ return self.__status_type
78
+
68
79
  @adapter_logger
69
80
  def set_title(self, title: str):
70
81
  self.__title = HtmlEscapeUtils.escape_html_tags(title)
@@ -30,6 +30,7 @@ class AdapterManager:
30
30
  ):
31
31
 
32
32
  self.__config = adapter_configuration
33
+ self.__client_config = client_configuration
33
34
  self.__api_client = ApiClientWorker(client_configuration)
34
35
  self.__fixture_manager = fixture_manager
35
36
  self.__test_result_map = {}
@@ -161,11 +162,14 @@ class AdapterManager:
161
162
  @adapter_logger
162
163
  def on_master_no_already_in_progress(self, test_result: TestResult) -> bool:
163
164
  # Convert TestResult to TestResultCutApiModel
165
+
166
+ project_id = self.__client_config.get_project_id()
164
167
  tr_cut_api_model = SyncStorageRunner.test_result_to_test_result_cut_api_model(
165
- test_result
168
+ test_result, project_id
166
169
  )
167
170
  logging.warning("Set as in progress status_code, auto_test_external_id: "
168
171
  + tr_cut_api_model.status_code + " " + tr_cut_api_model.auto_test_external_id)
172
+ logging.warning("Started_on: " + str(test_result.get_started_on()))
169
173
 
170
174
  # Send test result to Sync Storage
171
175
  success = self.__sync_storage_runner.send_in_progress_test_result(
@@ -39,13 +39,13 @@ class SyncStorageRunner:
39
39
  across multiple workers.
40
40
  """
41
41
 
42
- SYNC_STORAGE_VERSION = "v0.1.18"
42
+ SYNC_STORAGE_VERSION = "v0.2.0-tms-5.7"
43
43
  SYNC_STORAGE_REPO_URL = (
44
44
  "https://github.com/testit-tms/sync-storage-public/releases/download/"
45
45
  )
46
46
  AMD64 = "amd64"
47
47
  ARM64 = "arm64"
48
- SYNC_STORAGE_STARTUP_TIMEOUT = 30 # seconds
48
+ SYNC_STORAGE_STARTUP_TIMEOUT = 5 # seconds
49
49
 
50
50
  def __init__(
51
51
  self,
@@ -528,9 +528,11 @@ class SyncStorageRunner:
528
528
  @classmethod
529
529
  def test_result_to_test_result_cut_api_model(
530
530
  cls,
531
- test_result: TestResult) -> TestResultCutApiModel:
531
+ test_result: TestResult, project_id: str) -> TestResultCutApiModel:
532
532
  return TestResultCutApiModel(
533
+ project_id=project_id,
533
534
  auto_test_external_id=test_result.get_external_id(),
535
+ status_type=test_result.get_status_type(),
534
536
  status_code=test_result.get_outcome(),
535
537
  started_on=test_result.get_started_on(),
536
538
  )
@@ -123,7 +123,12 @@ class HtmlEscapeUtils:
123
123
  # Skip private/protected attributes and methods
124
124
  if attr_name.startswith('_') or callable(getattr(obj, attr_name, None)):
125
125
  continue
126
- if attr_name.startswith("external_id") or attr_name.startswith("externalId"):
126
+ if (
127
+ attr_name.startswith("external_id")
128
+ or attr_name.startswith("externalId")
129
+ or attr_name.startswith("auto_test_external_id")
130
+ or attr_name.startswith("autoTestExternalId")
131
+ ):
127
132
  continue
128
133
 
129
134
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 4.0.0
3
+ Version: 4.1.0.post570
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.5.3
20
+ Requires-Dist: testit-api-client==7.5.5.post570
21
21
  Dynamic: author
22
22
  Dynamic: author-email
23
23
  Dynamic: classifier
@@ -52,6 +52,7 @@ src/testit_python_commons/models/fixture.py
52
52
  src/testit_python_commons/models/link.py
53
53
  src/testit_python_commons/models/link_type.py
54
54
  src/testit_python_commons/models/outcome_type.py
55
+ src/testit_python_commons/models/status_type.py
55
56
  src/testit_python_commons/models/step_result.py
56
57
  src/testit_python_commons/models/test_result.py
57
58
  src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py
@@ -0,0 +1,3 @@
1
+ pluggy
2
+ tomli
3
+ testit-api-client==7.5.5.post570
@@ -10,6 +10,15 @@ class SampleData:
10
10
  self.tags = ["<tag>", "normal_tag"]
11
11
 
12
12
 
13
+ class SampleExternalIdsData:
14
+ def __init__(self):
15
+ self.external_id = "<test>"
16
+ self.externalId = "<test-camel>"
17
+ self.auto_test_external_id = "<auto-test>"
18
+ self.autoTestExternalId = "<auto-test-camel>"
19
+ self.description = "<script>alert('xss')</script>"
20
+
21
+
13
22
  class TestHtmlEscapeUtils(unittest.TestCase):
14
23
 
15
24
  def test_escape_html_tags_basic(self):
@@ -70,6 +79,17 @@ class TestHtmlEscapeUtils(unittest.TestCase):
70
79
  self.assertEqual(result.tags[0], "&lt;tag&gt;") # Escaped
71
80
  self.assertEqual(result.tags[1], "normal_tag") # No escaping needed
72
81
 
82
+ def test_escape_html_in_object_skips_external_id_fields(self):
83
+ """Test that externalId fields are not escaped"""
84
+ test_obj = SampleExternalIdsData()
85
+ result = HtmlEscapeUtils.escape_html_in_object(test_obj)
86
+
87
+ self.assertEqual(result.external_id, "<test>")
88
+ self.assertEqual(result.externalId, "<test-camel>")
89
+ self.assertEqual(result.auto_test_external_id, "<auto-test>")
90
+ self.assertEqual(result.autoTestExternalId, "<auto-test-camel>")
91
+ self.assertEqual(result.description, "&lt;script&gt;alert('xss')&lt;/script&gt;")
92
+
73
93
  def test_escape_html_in_object_list(self):
74
94
  """Test HTML escaping in list of objects"""
75
95
  test_list = [
@@ -1,3 +0,0 @@
1
- pluggy
2
- tomli
3
- testit-api-client==7.5.3