testit-python-commons 3.10.2__tar.gz → 3.10.4.post550__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 (51) hide show
  1. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/PKG-INFO +2 -2
  2. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/setup.py +2 -2
  3. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/api_client.py +25 -3
  4. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/client_configuration.py +0 -5
  5. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/converter.py +36 -1
  6. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/adapter_manager.py +29 -9
  7. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/adapter_manager_configuration.py +5 -0
  8. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  9. testit_python_commons-3.10.4.post550/src/testit_python_commons.egg-info/requires.txt +3 -0
  10. testit_python_commons-3.10.2/src/testit_python_commons.egg-info/requires.txt +0 -3
  11. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/README.md +0 -0
  12. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/setup.cfg +0 -0
  13. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit.py +0 -0
  14. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/__init__.py +0 -0
  15. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/app_properties.py +0 -0
  16. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/__init__.py +0 -0
  17. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/helpers/__init__.py +0 -0
  18. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/helpers/bulk_autotest_helper.py +0 -0
  19. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/helpers/threads_manager.py +0 -0
  20. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/models/__init__.py +0 -0
  21. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/models/threads_for_create_and_result.py +0 -0
  22. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/client/models/threads_for_update_and_result.py +0 -0
  23. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/decorators.py +0 -0
  24. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/dynamic_methods.py +0 -0
  25. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/__init__.py +0 -0
  26. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/adapter_mode.py +0 -0
  27. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/fixture.py +0 -0
  28. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/link.py +0 -0
  29. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/link_type.py +0 -0
  30. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/outcome_type.py +0 -0
  31. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/step_result.py +0 -0
  32. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/test_result.py +0 -0
  33. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  34. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/__init__.py +0 -0
  35. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/fixture_manager.py +0 -0
  36. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/fixture_storage.py +0 -0
  37. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/logger.py +0 -0
  38. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/plugin_manager.py +0 -0
  39. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/retry.py +0 -0
  40. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/step_manager.py +0 -0
  41. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/step_result_storage.py +0 -0
  42. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/services/utils.py +0 -0
  43. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/step.py +0 -0
  44. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/utils/__init__.py +0 -0
  45. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons/utils/html_escape_utils.py +0 -0
  46. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
  47. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  48. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/src/testit_python_commons.egg-info/top_level.txt +0 -0
  49. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/tests/test_app_properties.py +0 -0
  50. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/tests/test_dynamic_methods.py +0 -0
  51. {testit_python_commons-3.10.2 → testit_python_commons-3.10.4.post550}/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.10.2
3
+ Version: 3.10.4.post550
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.1.2
20
+ Requires-Dist: testit-api-client==7.2.0.post550
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.10.2"
3
+ VERSION = "3.10.4.post550"
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.1.2']
28
+ install_requires=['pluggy', 'tomli', 'testit-api-client==7.2.0.post550']
29
29
  )
@@ -10,9 +10,9 @@ from testit_api_client.models import (
10
10
  AutoTestPostModel,
11
11
  AutoTestPutModel,
12
12
  AttachmentPutModel,
13
- ApiV2AutoTestsSearchPostRequest,
14
13
  TestResultResponse,
15
14
  TestResultShortResponse,
15
+ TestRunV2ApiResult,
16
16
  LinkAutoTestToWorkItemRequest,
17
17
  WorkItemIdentifierModel
18
18
  )
@@ -67,9 +67,9 @@ class ApiClientWorker:
67
67
  return HtmlEscapeUtils.escape_html_in_object(model)
68
68
 
69
69
  @adapter_logger
70
- def create_test_run(self) -> str:
70
+ def create_test_run(self, test_run_name: str = None) -> str:
71
71
  test_run_name = f'TestRun_{datetime.today().strftime("%Y-%m-%dT%H:%M:%S")}' if \
72
- not self.__config.get_test_run_name() else self.__config.get_test_run_name()
72
+ not test_run_name else test_run_name
73
73
  model = Converter.test_run_to_test_run_short_model(
74
74
  self.__config.get_project_id(),
75
75
  test_run_name
@@ -80,6 +80,28 @@ class ApiClientWorker:
80
80
 
81
81
  return Converter.get_id_from_create_test_run_response(response)
82
82
 
83
+ def get_test_run(self, test_run_id: str) -> TestRunV2ApiResult:
84
+ """Function gets test run and returns test run."""
85
+ logging.debug(f"Getting test run by id {test_run_id}")
86
+
87
+ test_run = self.__test_run_api.get_test_run_by_id(test_run_id)
88
+ if test_run is not None:
89
+ logging.debug(f"Got testrun: {test_run}")
90
+ return test_run
91
+
92
+ logging.error(f"Test run by id {test_run_id} not found!")
93
+ raise Exception(f"Test run by id {test_run_id} not found!")
94
+
95
+ def update_test_run(self, test_run: TestRunV2ApiResult) -> None:
96
+ """Function updates test run."""
97
+ model = Converter.build_update_empty_request(test_run)
98
+ model = HtmlEscapeUtils.escape_html_in_object(model)
99
+ logging.debug(f"Updating test run with model: {model}")
100
+
101
+ self.__test_run_api.update_empty(update_empty_request=model)
102
+
103
+ logging.debug(f'Updated testrun (ID: {test_run.id})')
104
+
83
105
  @adapter_logger
84
106
  def set_test_run_id(self, test_run_id: str) -> None:
85
107
  self.__config.set_test_run_id(test_run_id)
@@ -16,7 +16,6 @@ class ClientConfiguration:
16
16
  self.__url = Utils.url_check(app_properties.get('url'))
17
17
  self.__private_token = app_properties.get('privatetoken')
18
18
  self.__configuration_id = Utils.uuid_check(app_properties.get('configurationid'))
19
- self.__test_run_name = app_properties.get('testrunname')
20
19
  self.__tms_proxy = app_properties.get('tmsproxy')
21
20
  self.__adapter_mode = app_properties.get('adaptermode')
22
21
  self.__cert_validation = app_properties.get('certvalidation')
@@ -50,10 +49,6 @@ class ClientConfiguration:
50
49
  def set_test_run_id(self, test_run_id: str):
51
50
  self.__test_run_id = test_run_id
52
51
 
53
- @adapter_logger
54
- def get_test_run_name(self):
55
- return self.__test_run_name
56
-
57
52
  @adapter_logger
58
53
  def get_proxy(self):
59
54
  return self.__tms_proxy
@@ -25,7 +25,11 @@ from testit_api_client.models import (
25
25
  ApiV2TestResultsIdPutRequest,
26
26
  TestResultResponse,
27
27
  AttachmentApiResult,
28
- AttachmentUpdateRequest
28
+ AttachmentUpdateRequest,
29
+ UpdateEmptyRequest,
30
+ LinkApiResult,
31
+ UpdateLinkApiModel,
32
+ AssignAttachmentApiModel,
29
33
  )
30
34
 
31
35
  from testit_python_commons.models.link import Link
@@ -49,6 +53,35 @@ class Converter:
49
53
  def get_id_from_create_test_run_response(response: TestRunV2ApiResult) -> str:
50
54
  return response.id
51
55
 
56
+ @classmethod
57
+ @adapter_logger
58
+ def build_update_empty_request(cls, test_run: TestRunV2ApiResult) -> UpdateEmptyRequest:
59
+ return UpdateEmptyRequest(
60
+ id=test_run.id,
61
+ name=test_run.name,
62
+ description=test_run.description,
63
+ launch_source=test_run.launch_source,
64
+ attachments=list(map(cls.build_assign_attachment_api_model, test_run.attachments)),
65
+ links=list(map(cls.build_update_link_api_model, test_run.links))
66
+ )
67
+
68
+ @staticmethod
69
+ @adapter_logger
70
+ def build_update_link_api_model(link: LinkApiResult) -> UpdateLinkApiModel:
71
+ return UpdateLinkApiModel(
72
+ id=link.id,
73
+ title=link.title,
74
+ description=link.description,
75
+ type=link.type,
76
+ url=link.url,
77
+ has_info=link.has_info
78
+ )
79
+
80
+ @staticmethod
81
+ @adapter_logger
82
+ def build_assign_attachment_api_model(attachment: AttachmentApiResult) -> AssignAttachmentApiModel:
83
+ return AssignAttachmentApiModel(id=attachment.id)
84
+
52
85
  @staticmethod
53
86
  @adapter_logger
54
87
  def project_id_and_external_id_to_auto_tests_search_post_request(
@@ -67,6 +100,7 @@ class Converter:
67
100
  return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
68
101
 
69
102
  @staticmethod
103
+ @adapter_logger
70
104
  def build_test_results_search_post_request_with_in_progress_outcome(
71
105
  testrun_id: str,
72
106
  configuration_id: str) -> ApiV2TestResultsSearchPostRequest:
@@ -76,6 +110,7 @@ class Converter:
76
110
  status_codes=["InProgress"])
77
111
 
78
112
  @staticmethod
113
+ @adapter_logger
79
114
  def autotest_ids_to_autotests_search_post_request(
80
115
  autotest_ids: List[int]) -> ApiV2AutoTestsSearchPostRequest:
81
116
  autotests_filter = AutoTestSearchApiModelFilter(
@@ -24,16 +24,36 @@ class AdapterManager:
24
24
  self.__test_results = []
25
25
 
26
26
  @adapter_logger
27
- def set_test_run_id(self, test_run_id: str):
27
+ def set_test_run_id(self, test_run_id: str) -> None:
28
28
  self.__config.set_test_run_id(test_run_id)
29
29
  self.__api_client.set_test_run_id(test_run_id)
30
30
 
31
31
  @adapter_logger
32
- def get_test_run_id(self):
32
+ def get_test_run_id(self) -> str:
33
33
  if self.__config.get_mode() != AdapterMode.NEW_TEST_RUN:
34
- return self.__config.get_test_run_id()
34
+ test_run_id = self.__config.get_test_run_id()
35
35
 
36
- return self.__api_client.create_test_run()
36
+ self.__update_test_run_name(test_run_id)
37
+
38
+ return test_run_id
39
+
40
+ return self.__api_client.create_test_run(self.__config.get_test_run_name())
41
+
42
+ @adapter_logger
43
+ def __update_test_run_name(self, test_run_id: str) -> None:
44
+ test_run_name = self.__config.get_test_run_name()
45
+
46
+ if not test_run_name:
47
+ return
48
+
49
+ test_run = self.__api_client.get_test_run(test_run_id)
50
+
51
+ if test_run_name == test_run.name:
52
+ return
53
+
54
+ test_run.name = test_run_name
55
+
56
+ self.__api_client.update_test_run(test_run)
37
57
 
38
58
  @adapter_logger
39
59
  def get_autotests_for_launch(self):
@@ -43,7 +63,7 @@ class AdapterManager:
43
63
  return
44
64
 
45
65
  @adapter_logger
46
- def write_test(self, test_result: TestResult):
66
+ def write_test(self, test_result: TestResult) -> None:
47
67
  if self.__config.should_import_realtime():
48
68
  self.__write_test_realtime(test_result)
49
69
 
@@ -52,14 +72,14 @@ class AdapterManager:
52
72
  self.__test_results.append(test_result)
53
73
 
54
74
  @adapter_logger
55
- def __write_test_realtime(self, test_result: TestResult):
75
+ def __write_test_realtime(self, test_result: TestResult) -> None:
56
76
  test_result.set_automatic_creation_test_cases(
57
77
  self.__config.should_automatic_creation_test_cases())
58
78
 
59
79
  self.__test_result_map[test_result.get_external_id()] = self.__api_client.write_test(test_result)
60
80
 
61
81
  @adapter_logger
62
- def write_tests(self):
82
+ def write_tests(self) -> None:
63
83
  if self.__config.should_import_realtime():
64
84
  self.__load_setup_and_teardown_step_results()
65
85
 
@@ -68,11 +88,11 @@ class AdapterManager:
68
88
  self.__write_tests_after_all()
69
89
 
70
90
  @adapter_logger
71
- def __load_setup_and_teardown_step_results(self):
91
+ def __load_setup_and_teardown_step_results(self) -> None:
72
92
  self.__api_client.update_test_results(self.__fixture_manager.get_all_items(), self.__test_result_map)
73
93
 
74
94
  @adapter_logger
75
- def __write_tests_after_all(self):
95
+ def __write_tests_after_all(self) -> None:
76
96
  fixtures = self.__fixture_manager.get_all_items()
77
97
 
78
98
  self.__api_client.write_tests(self.__test_results, fixtures)
@@ -14,6 +14,7 @@ class AdapterManagerConfiguration:
14
14
  self.__automatic_creation_test_cases = Utils.convert_value_str_to_bool(
15
15
  app_properties.get('automaticcreationtestcases'))
16
16
  self.__import_realtime = Utils.convert_value_str_to_bool(app_properties.get('importrealtime'))
17
+ self.__test_run_name = app_properties.get('testrunname')
17
18
 
18
19
  @adapter_logger
19
20
  def get_test_run_id(self):
@@ -23,6 +24,10 @@ class AdapterManagerConfiguration:
23
24
  def set_test_run_id(self, test_run_id: str):
24
25
  self.__test_run_id = test_run_id
25
26
 
27
+ @adapter_logger
28
+ def get_test_run_name(self):
29
+ return self.__test_run_name
30
+
26
31
  @adapter_logger
27
32
  def get_mode(self):
28
33
  return self.__adapter_mode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 3.10.2
3
+ Version: 3.10.4.post550
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.1.2
20
+ Requires-Dist: testit-api-client==7.2.0.post550
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.2.0.post550
@@ -1,3 +0,0 @@
1
- pluggy
2
- tomli
3
- testit-api-client==7.1.2