testit-cli 2.4.11.post540__tar.gz → 2.5.0__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 (38) hide show
  1. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/PKG-INFO +3 -3
  2. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/README.md +1 -1
  3. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/setup.py +2 -2
  4. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/apiclient.py +54 -39
  5. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/autotests_filter.py +12 -7
  6. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/converter.py +45 -25
  7. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/dir_worker.py +1 -1
  8. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/file_worker.py +2 -2
  9. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/filter_factory.py +10 -10
  10. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/importer.py +8 -7
  11. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/logger.py +1 -1
  12. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/models/config.py +3 -2
  13. testit_cli-2.5.0/src/testit_cli/models/testcase.py +61 -0
  14. testit_cli-2.5.0/src/testit_cli/models/testrun.py +16 -0
  15. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/parser.py +4 -3
  16. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/service.py +10 -4
  17. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli.egg-info/PKG-INFO +3 -3
  18. testit_cli-2.5.0/src/testit_cli.egg-info/requires.txt +4 -0
  19. testit_cli-2.4.11.post540/src/testit_cli/models/testcase.py +0 -60
  20. testit_cli-2.4.11.post540/src/testit_cli/models/testrun.py +0 -13
  21. testit_cli-2.4.11.post540/src/testit_cli.egg-info/requires.txt +0 -4
  22. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/LICENSE +0 -0
  23. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/setup.cfg +0 -0
  24. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/__init__.py +0 -0
  25. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/__main__.py +0 -0
  26. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/click_commands.py +0 -0
  27. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/html_escape_utils.py +0 -0
  28. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/models/__init__.py +0 -0
  29. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/models/mode.py +0 -0
  30. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/models/status.py +0 -0
  31. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/service_factory.py +0 -0
  32. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli/validation.py +0 -0
  33. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli.egg-info/SOURCES.txt +0 -0
  34. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli.egg-info/dependency_links.txt +0 -0
  35. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli.egg-info/entry_points.txt +0 -0
  36. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/src/testit_cli.egg-info/top_level.txt +0 -0
  37. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/tests/test_click.py +0 -0
  38. {testit_cli-2.4.11.post540 → testit_cli-2.5.0}/tests/test_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-cli
3
- Version: 2.4.11.post540
3
+ Version: 2.5.0
4
4
  Summary: This tool is the command line wrapper of Test IT allowing you to upload the test results in real time to Test IT
5
5
  Home-page: https://pypi.org/project/testit-cli/
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
  License-File: LICENSE
19
- Requires-Dist: testit-api-client==6.3.1.post540
19
+ Requires-Dist: testit-api-client==7.0.1
20
20
  Requires-Dist: validators
21
21
  Requires-Dist: tqdm
22
22
  Requires-Dist: click~=8.0.4
@@ -54,4 +54,4 @@ You can see more information in [official documentation](https://docs.testit.sof
54
54
  | 5.2.3 | 2.3.0.post523 |
55
55
  | 5.3 | 2.4.5.post530 |
56
56
  | 5.4 | 2.4.11.post540 |
57
- | Cloud | 2.4.10 |
57
+ | Cloud | 2.4.11 |
@@ -21,4 +21,4 @@ You can see more information in [official documentation](https://docs.testit.sof
21
21
  | 5.2.3 | 2.3.0.post523 |
22
22
  | 5.3 | 2.4.5.post530 |
23
23
  | 5.4 | 2.4.11.post540 |
24
- | Cloud | 2.4.10 |
24
+ | Cloud | 2.4.11 |
@@ -1,6 +1,6 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
- VERSION = "2.4.11.post540"
3
+ VERSION = "2.5.0"
4
4
 
5
5
  setup(
6
6
  name='testit-cli',
@@ -26,7 +26,7 @@ setup(
26
26
  py_modules=['testit_cli'],
27
27
  packages=find_packages(where='src'),
28
28
  package_dir={'': 'src'},
29
- install_requires=['testit-api-client==6.3.1.post540', 'validators', 'tqdm', 'click~=8.0.4'],
29
+ install_requires=['testit-api-client==7.0.1', 'validators', 'tqdm', 'click~=8.0.4'],
30
30
  entry_points={
31
31
  'console_scripts': [
32
32
  'testit = testit_cli.__main__:console_main'
@@ -3,11 +3,20 @@ import logging
3
3
  import os
4
4
  import typing
5
5
 
6
- from testit_api_client import ApiClient as TmsClient, CreateEmptyTestRunApiModel, AutoTestApiResult, \
7
- AutoTestSearchApiModel, AssignAttachmentApiModel
6
+ from testit_api_client import ApiClient as TmsClient
8
7
  from testit_api_client import Configuration
9
- from testit_api_client.api import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi
10
- from testit_api_client.models import TestResultShortResponse
8
+ from testit_api_client.apis import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi
9
+ from testit_api_client.model.api_v2_auto_tests_search_post_request import ApiV2AutoTestsSearchPostRequest
10
+ from testit_api_client.model.api_v2_test_results_search_post_request import ApiV2TestResultsSearchPostRequest
11
+ from testit_api_client.model.attachment_model import AttachmentModel
12
+ from testit_api_client.model.attachment_put_model import AttachmentPutModel
13
+ from testit_api_client.model.auto_test_model import AutoTestModel
14
+ from testit_api_client.model.auto_test_results_for_test_run_model import AutoTestResultsForTestRunModel
15
+ from testit_api_client.model.create_auto_test_request import CreateAutoTestRequest
16
+ from testit_api_client.model.test_run_v2_api_result import TestRunV2ApiResult
17
+ from testit_api_client.model.update_auto_test_request import UpdateAutoTestRequest
18
+ from testit_api_client.model.update_empty_request import UpdateEmptyRequest
19
+ from testit_api_client.models import TestResultShortResponse, CreateEmptyRequest, AutoTestApiResult
11
20
 
12
21
  from .converter import Converter
13
22
  from .models.testrun import TestRun
@@ -15,7 +24,7 @@ from .html_escape_utils import HtmlEscapeUtils
15
24
 
16
25
 
17
26
  class ApiClient:
18
- """Class representing a api client"""
27
+ """Class representing an api client"""
19
28
 
20
29
  def __init__(self, url: str, token: str, disable_cert_validation: bool):
21
30
  client_config = Configuration(host=url)
@@ -34,28 +43,29 @@ class ApiClient:
34
43
 
35
44
  def create_test_run(self, project_id: str, name: str) -> TestRun:
36
45
  """Function creates test run and returns test run id."""
37
- model = CreateEmptyTestRunApiModel(project_id=project_id, name=name)
46
+ model = CreateEmptyRequest(project_id=project_id, name=name)
38
47
  model = HtmlEscapeUtils.escape_html_in_object(model)
39
48
  logging.debug(f"Creating test run with model: {model}")
40
49
 
41
- test_run = self.__test_run_api.create_empty(model)
50
+ test_run: TestRunV2ApiResult = self.__test_run_api.create_empty(create_empty_request=model)
42
51
 
43
52
  logging.info(f'Created new testrun (ID: {test_run.id})')
44
53
  logging.debug(f"Test run created: {test_run}")
45
54
 
46
55
  return Converter.test_run_v2_get_model_to_test_run(test_run)
47
56
 
48
- def update_test_run(self, test_run: TestRun):
57
+ def update_test_run(self, test_run: TestRun) -> None:
49
58
  """Function updates test run."""
50
- model = Converter.test_run_to_update_empty_request(test_run)
59
+ model: UpdateEmptyRequest = Converter.test_run_to_update_empty_request(test_run)
51
60
  model = HtmlEscapeUtils.escape_html_in_object(model)
52
61
  logging.debug(f"Updating test run with model: {model}")
53
62
 
54
- self.__test_run_api.update_empty(model)
63
+ # UpdateEmptyRequest
64
+ self.__test_run_api.update_empty(update_empty_request=model)
55
65
 
56
66
  logging.info(f'Updated testrun (ID: {test_run.id})')
57
67
 
58
- def complete_test_run(self, test_run_id: str):
68
+ def complete_test_run(self, test_run_id: str) -> None:
59
69
  """Function completes test run."""
60
70
  logging.debug(f"Completing test run {test_run_id}")
61
71
 
@@ -65,64 +75,67 @@ class ApiClient:
65
75
 
66
76
  logging.info(f"Completed testrun (ID: {test_run_id})")
67
77
 
68
- def get_test_run(self, test_run_id: str) -> Converter.test_run_v2_get_model_to_test_run:
78
+ def get_test_run(self, test_run_id: str) -> TestRun:
69
79
  """Function gets test run and returns test run."""
70
80
  logging.debug(f"Getting test run {test_run_id}")
71
81
 
72
- test_run = self.__test_run_api.get_test_run_by_id(test_run_id)
82
+ test_run: TestRunV2ApiResult = self.__test_run_api.get_test_run_by_id(test_run_id)
73
83
  if test_run is not None:
74
84
  logging.debug(f"Got testrun (ID: {test_run_id})")
75
85
  return Converter.test_run_v2_get_model_to_test_run(test_run)
76
86
 
77
87
  logging.error(f"Test run {test_run_id} not found!")
88
+ raise Exception("Test run {test_run_id} not found!")
78
89
 
79
- def get_autotests(self, model: AutoTestSearchApiModel) \
90
+ def get_autotests(self, model: ApiV2AutoTestsSearchPostRequest) \
80
91
  -> list[AutoTestApiResult]:
81
92
  """Function returns list of AutoTestApiResult."""
82
93
  logging.debug(f"Getting autotests: {model}")
83
94
 
84
- autotests = self.__autotest_api.api_v2_auto_tests_search_post(auto_test_search_api_model=model)
95
+ autotests: list[AutoTestApiResult] = (self.__autotest_api.api_v2_auto_tests_search_post
96
+ (api_v2_auto_tests_search_post_request=model))
85
97
 
86
98
  logging.debug(f"Got autotests: {autotests}")
87
99
 
88
100
  return autotests
89
101
 
90
- def create_autotest(self, model: Converter.test_result_to_create_autotest_request):
102
+ def create_autotest(self, model: CreateAutoTestRequest) -> str:
91
103
  """Function creates autotest and returns autotest id."""
92
104
  model = HtmlEscapeUtils.escape_html_in_object(model)
93
105
 
94
106
  logging.debug(f"Creating autotest {model}")
95
107
 
96
- response = self.__autotest_api.create_auto_test(auto_test_post_model=model)
108
+ response: AutoTestModel = self.__autotest_api.create_auto_test(create_auto_test_request=model)
97
109
 
98
110
  logging.debug(f"Created autotest {response}")
99
111
 
100
- return response.id
112
+ return str(response.id)
101
113
 
102
- def update_autotest(self, model: Converter.test_result_to_update_autotest_request):
114
+ def update_autotest(self, model: UpdateAutoTestRequest) -> None:
103
115
  """Function updates autotest"""
104
116
  try:
105
- model = HtmlEscapeUtils.escape_html_in_object(model)
117
+ escaped_model: UpdateAutoTestRequest = HtmlEscapeUtils.escape_html_in_object(model)
106
118
 
107
- logging.debug(f"Updating autotest {model}")
119
+ logging.debug(f"Updating autotest {escaped_model}")
108
120
 
109
- self.__autotest_api.update_auto_test(auto_test_put_model=model)
121
+ # UpdateAutoTestRequest
122
+ self.__autotest_api.update_auto_test(update_auto_test_request=escaped_model)
110
123
 
111
124
  logging.debug(f'Updated "{model.name}" successfully!')
112
125
  except Exception as exc:
113
126
  logging.error(f'Updated "{model.name}" status: {exc}')
114
127
 
115
128
  def send_test_result(
116
- self, testrun_id: str, model: Converter.test_result_to_testrun_result_post_model
117
- ):
129
+ self, testrun_id: str, model: AutoTestResultsForTestRunModel
130
+ ) -> None:
118
131
  """Function sends autotest result to test run"""
119
132
  try:
120
- model = HtmlEscapeUtils.escape_html_in_object(model)
133
+ escaped_model: AutoTestResultsForTestRunModel = HtmlEscapeUtils.escape_html_in_object(model)
121
134
 
122
- logging.debug(f"Adding autotest results to testrun {testrun_id}: {model}")
135
+ logging.debug(f"Adding autotest results to testrun {testrun_id}: {escaped_model}")
123
136
 
124
137
  self.__test_run_api.set_auto_test_results_for_test_run(
125
- id=testrun_id, auto_test_results_for_test_run_model=[model]
138
+ id=testrun_id, auto_test_results_for_test_run_model=[escaped_model]
126
139
  )
127
140
  logging.debug(
128
141
  f"Added autotest results to testrun {testrun_id} successfully"
@@ -130,21 +143,23 @@ class ApiClient:
130
143
  except Exception as exc:
131
144
  logging.error(f"Set result status: {exc}")
132
145
 
133
- def upload_attachments(self, attachments: typing.List[str]) -> typing.List[AssignAttachmentApiModel]:
146
+ def upload_attachments(self, attachments: typing.List[str]) -> typing.List[AttachmentPutModel]:
134
147
  """Function upload attachments and returns list of AttachmentPutModel."""
135
148
  attachment_ids = []
136
149
 
137
150
  for attachment in attachments:
138
151
  if os.path.isfile(attachment):
139
- try:
140
- attachment_response = self.__attachments_api.api_v2_attachments_post(
141
- file=attachment)
152
+ with open(attachment, "rb+") as file:
153
+ try:
154
+ attachment_response: AttachmentModel = self.__attachments_api.api_v2_attachments_post(
155
+ # file_type
156
+ file=file)
142
157
 
143
- attachment_ids.append(AssignAttachmentApiModel(id=attachment_response.id))
158
+ attachment_ids.append(AttachmentPutModel(id=attachment_response.id))
144
159
 
145
- logging.debug(f'Attachment "{attachment}" was uploaded')
146
- except Exception as exc:
147
- logging.error(f'Upload attachment "{attachment}" status: {exc}')
160
+ logging.debug(f'Attachment "{attachment}" was uploaded')
161
+ except Exception as exc:
162
+ logging.error(f'Upload attachment "{attachment}" status: {exc}')
148
163
  else:
149
164
  logging.error(f'File "{attachment}" was not found!')
150
165
 
@@ -152,13 +167,13 @@ class ApiClient:
152
167
 
153
168
  def get_test_results(
154
169
  self,
155
- model: Converter.testrun_id_and_configuration_id_and_in_progress_outcome_to_test_results_search_post_request
156
- ) -> typing.List[TestResultShortResponse]:
170
+ model: ApiV2TestResultsSearchPostRequest
171
+ ) -> list[TestResultShortResponse]:
157
172
  """Function returns list of TestResultShortGetModel."""
158
173
  logging.debug(f"Getting test results: {model}")
159
174
 
160
- test_results = self.__test_results_api.api_v2_test_results_search_post(
161
- test_results_filter_api_model=model)
175
+ test_results: list[TestResultShortResponse] = self.__test_results_api.api_v2_test_results_search_post(
176
+ api_v2_test_results_search_post_request=model)
162
177
 
163
178
  logging.debug(f"Got test results: {test_results}")
164
179
 
@@ -1,5 +1,9 @@
1
1
  import hashlib
2
2
 
3
+ from testit_api_client.model.api_v2_auto_tests_search_post_request import ApiV2AutoTestsSearchPostRequest
4
+ from testit_api_client.model.api_v2_test_results_search_post_request import ApiV2TestResultsSearchPostRequest
5
+ from testit_api_client.model.auto_test_api_result import AutoTestApiResult
6
+
3
7
  from .apiclient import ApiClient
4
8
  from .converter import Converter
5
9
  from .filter_factory import FilterFactory
@@ -13,11 +17,11 @@ class AutotestsFilter:
13
17
 
14
18
  def create_filter(self):
15
19
  """Function returns str of filter by autotests for test Framework run command."""
16
- test_results_search_post_model = (
20
+ test_results_search_post_request: ApiV2TestResultsSearchPostRequest = (
17
21
  Converter.testrun_id_and_configuration_id_and_in_progress_outcome_to_test_results_search_post_request(
18
22
  self.__config.testrun_id,
19
23
  self.__config.configuration_id))
20
- test_results = self.__api_client.get_test_results(test_results_search_post_model)
24
+ test_results = self.__api_client.get_test_results(test_results_search_post_request)
21
25
 
22
26
  if len(test_results) == 0:
23
27
  exception = f"Couldn't get the test results in progress by test run id \"{self.__config.testrun_id}\" " + \
@@ -25,13 +29,14 @@ class AutotestsFilter:
25
29
 
26
30
  raise Exception(exception)
27
31
 
28
- autotest_ids = Converter.test_result_short_get_models_to_autotest_ids(test_results)
29
- autotests_search_post_model = Converter.autotest_ids_to_autotests_search_post_request(autotest_ids)
30
- autotests = self.__api_client.get_autotests(autotests_search_post_model)
31
- external_keys = Converter.autotest_models_to_external_keys(autotests)
32
+ autotest_ids: list[int] = Converter.test_result_short_get_models_to_autotest_ids(test_results)
33
+ autotests_search_post_request: ApiV2AutoTestsSearchPostRequest = (
34
+ Converter.autotest_ids_to_autotests_search_post_request(autotest_ids))
35
+ autotests: list[AutoTestApiResult] = self.__api_client.get_autotests(autotests_search_post_request)
36
+ external_keys: list[str] = Converter.autotest_models_to_external_keys(autotests)
32
37
 
33
38
  return FilterFactory.get(self.__config, external_keys)
34
39
 
35
40
  @staticmethod
36
- def __get_external_id(value: str):
41
+ def __get_external_id(value: str) -> str:
37
42
  return hashlib.md5(value.encode("utf-8")).hexdigest()
@@ -1,53 +1,61 @@
1
1
  import typing
2
2
 
3
- from testit_api_client import UpdateEmptyTestRunApiModel, TestRunV2ApiResult, LinkApiResult, AttachmentApiResult, \
4
- AutoTestApiResult, AutoTestSearchApiModel, AutoTestFilterApiModel, AutoTestSearchIncludeApiModel, \
5
- TestResultsFilterApiModel
3
+ from testit_api_client.model.api_v2_auto_tests_search_post_request import ApiV2AutoTestsSearchPostRequest
4
+ from testit_api_client.model.api_v2_test_results_search_post_request import ApiV2TestResultsSearchPostRequest
5
+ from testit_api_client.model.attachment_api_result import AttachmentApiResult
6
+ from testit_api_client.model.auto_test_api_result import AutoTestApiResult
7
+ from testit_api_client.model.auto_test_search_api_model_filter import AutoTestSearchApiModelFilter
8
+ from testit_api_client.model.auto_test_search_api_model_includes import AutoTestSearchApiModelIncludes
9
+ from testit_api_client.model.create_auto_test_request import CreateAutoTestRequest
10
+ from testit_api_client.model.link_api_result import LinkApiResult
11
+ from testit_api_client.model.test_run_v2_api_result import TestRunV2ApiResult
12
+ from testit_api_client.model.update_auto_test_request import UpdateAutoTestRequest
13
+ from testit_api_client.model.update_empty_request import UpdateEmptyRequest
6
14
  from testit_api_client.models import (
7
15
  AutoTestResultsForTestRunModel,
8
16
  AttachmentPutModel,
9
- AutoTestPostModel,
10
- AutoTestPutModel,
11
17
  LinkPutModel,
12
18
  TestResultOutcome,
13
19
  TestResultShortResponse,
14
20
  )
21
+ from testit_api_client.model.assign_attachment_api_model import AssignAttachmentApiModel
15
22
 
23
+ from .models.testcase import TestCase
16
24
  from .models.testrun import TestRun
17
25
 
18
26
 
19
27
  class Converter:
20
28
  @staticmethod
21
29
  def project_id_and_external_id_to_autotests_search_post_request(
22
- project_id: str, external_id: str) -> AutoTestSearchApiModel:
23
- autotests_filter = AutoTestFilterApiModel(
30
+ project_id: str, external_id: str) -> ApiV2AutoTestsSearchPostRequest:
31
+ autotests_filter = AutoTestSearchApiModelFilter(
24
32
  project_ids=[project_id],
25
33
  external_ids=[external_id],
26
34
  is_deleted=False)
27
- autotests_includes = AutoTestSearchIncludeApiModel(
35
+ autotests_includes = AutoTestSearchApiModelIncludes(
28
36
  include_steps=False,
29
37
  include_links=False,
30
38
  include_labels=False)
31
39
 
32
- return AutoTestSearchApiModel(filter=autotests_filter, includes=autotests_includes)
40
+ return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
33
41
 
34
42
  @staticmethod
35
43
  def autotest_ids_to_autotests_search_post_request(
36
- autotest_ids: typing.List[int]) -> AutoTestSearchApiModel:
37
- autotests_filter = AutoTestFilterApiModel(
44
+ autotest_ids: typing.List[int]) -> ApiV2AutoTestsSearchPostRequest:
45
+ autotests_filter = AutoTestSearchApiModelFilter(
38
46
  global_ids=autotest_ids)
39
- autotests_includes = AutoTestSearchIncludeApiModel(
47
+ autotests_includes = AutoTestSearchApiModelIncludes(
40
48
  include_steps=False,
41
49
  include_links=False,
42
50
  include_labels=False)
43
51
 
44
- return AutoTestSearchApiModel(filter=autotests_filter, includes=autotests_includes)
52
+ return ApiV2AutoTestsSearchPostRequest(filter=autotests_filter, includes=autotests_includes)
45
53
 
46
54
  @staticmethod
47
55
  def testrun_id_and_configuration_id_and_in_progress_outcome_to_test_results_search_post_request(
48
56
  testrun_id: str,
49
- configuration_id: str) -> TestResultsFilterApiModel:
50
- return TestResultsFilterApiModel(
57
+ configuration_id: str) -> ApiV2TestResultsSearchPostRequest:
58
+ return ApiV2TestResultsSearchPostRequest(
51
59
  test_run_ids=[testrun_id],
52
60
  configuration_ids=[configuration_id],
53
61
  outcomes=[TestResultOutcome("InProgress")])
@@ -79,8 +87,8 @@ class Converter:
79
87
 
80
88
  @staticmethod
81
89
  def test_result_to_create_autotest_request(
82
- result, external_id: str, project_id: str) -> AutoTestPostModel:
83
- return AutoTestPostModel(
90
+ result: TestCase, external_id: str, project_id: str) -> CreateAutoTestRequest:
91
+ return CreateAutoTestRequest(
84
92
  external_id=external_id,
85
93
  project_id=project_id,
86
94
  name=result.get_name(),
@@ -90,8 +98,8 @@ class Converter:
90
98
 
91
99
  @staticmethod
92
100
  def test_result_to_update_autotest_request(
93
- result, external_id: str, project_id: str) -> AutoTestPutModel:
94
- return AutoTestPutModel(
101
+ result: TestCase, external_id: str, project_id: str) -> UpdateAutoTestRequest:
102
+ return UpdateAutoTestRequest(
95
103
  external_id=external_id,
96
104
  project_id=project_id,
97
105
  name=result.get_name(),
@@ -102,7 +110,7 @@ class Converter:
102
110
 
103
111
  @staticmethod
104
112
  def test_result_to_testrun_result_post_model(
105
- result, external_id: str, configuration_id: str
113
+ result: TestCase, external_id: str, configuration_id: str
106
114
  ) -> AutoTestResultsForTestRunModel:
107
115
  return AutoTestResultsForTestRunModel(
108
116
  configuration_id=configuration_id,
@@ -129,7 +137,7 @@ class Converter:
129
137
  @classmethod
130
138
  def attachment_models_to_attachment_put_models(
131
139
  cls,
132
- attachment_models: typing.List[AttachmentApiResult]) -> typing.List[AttachmentPutModel]:
140
+ attachment_models: typing.List[AttachmentApiResult]) -> typing.List[AssignAttachmentApiModel]:
133
141
  attachment_put_models = []
134
142
 
135
143
  for attachment_model in attachment_models:
@@ -139,8 +147,17 @@ class Converter:
139
147
  return attachment_put_models
140
148
 
141
149
  @staticmethod
142
- def attachment_model_to_attachment_put_model(attachment_model: AttachmentApiResult) -> AttachmentPutModel:
143
- return AttachmentPutModel(id=attachment_model.id)
150
+ def attachment_model_to_attachment_put_model(attachment_model: AttachmentApiResult) -> AssignAttachmentApiModel:
151
+ return AssignAttachmentApiModel(id=attachment_model.id)
152
+
153
+ @staticmethod
154
+ def attachment_put_model_to_assign_attachment(attachment_model: AttachmentPutModel) -> AssignAttachmentApiModel:
155
+ return AssignAttachmentApiModel(id=attachment_model.id)
156
+
157
+ @staticmethod
158
+ def attachment_put_models_to_assign_attachments(attachment_models: list[AttachmentPutModel])\
159
+ -> list[AssignAttachmentApiModel]:
160
+ return list(map(lambda x: Converter.attachment_put_model_to_assign_attachment(x), attachment_models))
144
161
 
145
162
  @classmethod
146
163
  def link_models_to_link_put_models(
@@ -166,10 +183,13 @@ class Converter:
166
183
  )
167
184
 
168
185
  @staticmethod
169
- def test_run_to_update_empty_request(test_run: TestRun) -> UpdateEmptyTestRunApiModel:
170
- return UpdateEmptyTestRunApiModel(
186
+ def test_run_to_update_empty_request(test_run: TestRun) -> UpdateEmptyRequest:
187
+ return UpdateEmptyRequest(
188
+ # str
171
189
  id=test_run.id,
190
+ # str
172
191
  name=test_run.name,
192
+ # str
173
193
  description=test_run.description,
174
194
  launch_source=test_run.launch_source,
175
195
  attachments=test_run.attachments,
@@ -19,7 +19,7 @@ class DirWorker:
19
19
  return os.path.exists(path_to_dir) and os.path.isdir(path_to_dir)
20
20
 
21
21
  @staticmethod
22
- def __split_path_to_dir_names(path_to_dir: str) -> tuple:
22
+ def __split_path_to_dir_names(path_to_dir: str) -> tuple[str, ...]:
23
23
  return PurePath(path_to_dir).parts[:-1]
24
24
 
25
25
  @staticmethod
@@ -4,7 +4,7 @@ import os
4
4
 
5
5
  class FileWorker:
6
6
  @classmethod
7
- def get_files(cls, path_to_files: str, files_type: str = None) -> list:
7
+ def get_files(cls, path_to_files: str, files_type: str = "") -> list[str]:
8
8
  if os.path.isdir(path_to_files):
9
9
  return glob.glob(cls.__get_pathname(path_to_files, files_type))
10
10
 
@@ -16,7 +16,7 @@ class FileWorker:
16
16
  return files
17
17
 
18
18
  @staticmethod
19
- def __get_pathname(path_to_files: str, files_type: str):
19
+ def __get_pathname(path_to_files: str, files_type: str) -> str:
20
20
  if files_type:
21
21
  return f"{path_to_files}/*.{files_type}"
22
22
 
@@ -36,12 +36,12 @@ class FilterFactory:
36
36
  return initialization[config.framework](external_keys)
37
37
 
38
38
  @classmethod
39
- def __initialize_pytest_filter(cls, external_keys: typing.List[str]):
39
+ def __initialize_pytest_filter(cls, external_keys: typing.List[str]) -> str:
40
40
  """Initialize filter for pytest run"""
41
41
  return '-k\n' + ' or '.join(external_keys)
42
42
 
43
43
  @staticmethod
44
- def __initialize_robotframework_filter(external_keys: typing.List[str]):
44
+ def __initialize_robotframework_filter(external_keys: typing.List[str]) -> str:
45
45
  """Initialize filter for RobotFramework run"""
46
46
  robotframework_filter = ""
47
47
 
@@ -51,17 +51,17 @@ class FilterFactory:
51
51
  return robotframework_filter
52
52
 
53
53
  @staticmethod
54
- def __initialize_behave_filter(external_keys: typing.List[str]):
54
+ def __initialize_behave_filter(external_keys: typing.List[str]) -> str:
55
55
  """Initialize filter for Behave run"""
56
56
  return '-n' + '|'.join(external_keys)
57
57
 
58
58
  @classmethod
59
- def __initialize_nose_filter(cls, external_keys: typing.List[str]):
59
+ def __initialize_nose_filter(cls, external_keys: typing.List[str]) -> str:
60
60
  """Initialize filter for Nose run"""
61
61
  return ' '.join(external_keys)
62
62
 
63
63
  @staticmethod
64
- def __initialize_gradle_testng_junit4_junit5_filter(external_keys: typing.List[str]):
64
+ def __initialize_gradle_testng_junit4_junit5_filter(external_keys: typing.List[str]) -> str:
65
65
  """Initialize filter for gradle TestNG or JUnit4 or JUnit5 run with gradle"""
66
66
  autotest_keys = []
67
67
 
@@ -76,7 +76,7 @@ class FilterFactory:
76
76
  # return '+' + ' '.join(external_keys)
77
77
 
78
78
  @staticmethod
79
- def __initialize_maven_testng_junit4_junit5_filter(external_keys: typing.List[str]):
79
+ def __initialize_maven_testng_junit4_junit5_filter(external_keys: typing.List[str]) -> str:
80
80
  """Initialize filter for TestNG or JUnit4 or JUnit5 run with maven"""
81
81
  autotest_keys = []
82
82
 
@@ -86,12 +86,12 @@ class FilterFactory:
86
86
  return ' '.join(autotest_keys)
87
87
 
88
88
  @classmethod
89
- def __initialize_codeceptjs_mocha_playwright_filter(cls, external_keys: typing.List[str]):
89
+ def __initialize_codeceptjs_mocha_playwright_filter(cls, external_keys: typing.List[str]) -> str:
90
90
  """Initialize filter for CodeceptJS or Mocha or Playwright run"""
91
91
  return '|'.join(external_keys)
92
92
 
93
93
  @classmethod
94
- def __initialize_cucumber_cucumberjs_jest_golang_filter(cls, external_keys: typing.List[str]):
94
+ def __initialize_cucumber_cucumberjs_jest_golang_filter(cls, external_keys: typing.List[str]) -> str:
95
95
  """Initialize filter for Cucumber or CucumberJS or Jest or Golang run"""
96
96
  autotest_keys = []
97
97
 
@@ -101,7 +101,7 @@ class FilterFactory:
101
101
  return '|'.join(autotest_keys)
102
102
 
103
103
  @staticmethod
104
- def __initialize_mstest_nunit_xunit_filter(external_keys: typing.List[str]):
104
+ def __initialize_mstest_nunit_xunit_filter(external_keys: typing.List[str]) -> str:
105
105
  """Initialize filter for MSTest or NUnit or XUnit run"""
106
106
  autotest_keys = []
107
107
 
@@ -111,7 +111,7 @@ class FilterFactory:
111
111
  return '|'.join(autotest_keys)
112
112
 
113
113
  @staticmethod
114
- def __initialize_specflow_filter(external_keys: typing.List[str]):
114
+ def __initialize_specflow_filter(external_keys: typing.List[str]) -> str:
115
115
  """Initialize filter for SpecFlow run"""
116
116
  autotest_keys = []
117
117
 
@@ -1,5 +1,7 @@
1
1
  import hashlib
2
2
 
3
+ from testit_api_client.model.api_v2_auto_tests_search_post_request import ApiV2AutoTestsSearchPostRequest
4
+ from testit_api_client.model.auto_test_api_result import AutoTestApiResult
3
5
  from tqdm import tqdm
4
6
 
5
7
  from .apiclient import ApiClient
@@ -13,7 +15,7 @@ class Importer:
13
15
  self.__api_client = api_client
14
16
  self.__config = config
15
17
 
16
- def send_results(self, results: [TestCase]):
18
+ def send_results(self, results: list[TestCase]) -> None:
17
19
  for result in tqdm(results, desc="Uploading"):
18
20
  external_id = self.__get_external_id(
19
21
  result.get_name_space()
@@ -21,11 +23,10 @@ class Importer:
21
23
  + result.get_name()
22
24
  )
23
25
 
24
- autotests = self.__api_client.get_autotests(
25
- Converter.project_id_and_external_id_to_autotests_search_post_request(
26
- self.__config.project_id, external_id
27
- )
28
- )
26
+ request: ApiV2AutoTestsSearchPostRequest = (Converter
27
+ .project_id_and_external_id_to_autotests_search_post_request
28
+ (self.__config.project_id, external_id))
29
+ autotests: list[AutoTestApiResult] = self.__api_client.get_autotests(request)
29
30
 
30
31
  if not autotests:
31
32
  self.__api_client.create_autotest(
@@ -50,5 +51,5 @@ class Importer:
50
51
  )
51
52
 
52
53
  @staticmethod
53
- def __get_external_id(value: str):
54
+ def __get_external_id(value: str) -> str:
54
55
  return hashlib.md5(value.encode("utf-8")).hexdigest()
@@ -5,7 +5,7 @@ class Logger:
5
5
  """Class representing a logger factory"""
6
6
 
7
7
  @staticmethod
8
- def register_logger(is_debug: bool):
8
+ def register_logger(is_debug: bool) -> None:
9
9
  """Function registers loggers."""
10
10
 
11
11
  logging.basicConfig(
@@ -1,4 +1,5 @@
1
1
  from dataclasses import dataclass
2
+ import typing
2
3
 
3
4
 
4
5
  @dataclass
@@ -12,10 +13,10 @@ class Config:
12
13
  separator: str
13
14
  namespace: str
14
15
  classname: str
15
- results: list
16
+ results: list[typing.Any]
16
17
  is_debug: bool
17
18
  output: str
18
- paths_to_attachments: list
19
+ paths_to_attachments: list[typing.Any]
19
20
  disable_cert_validation: bool
20
21
  framework: str
21
22
  ignore_flaky_failure: bool
@@ -0,0 +1,61 @@
1
+ from datetime import timedelta
2
+ from typing import Optional
3
+
4
+ from testit_api_client.models import AvailableTestResultOutcome
5
+
6
+ from .status import Status
7
+
8
+
9
+ class TestCase:
10
+ __name: Optional[str] = None
11
+ __name_space: Optional[str] = None
12
+ __class_name: Optional[str] = None
13
+ __duration: Optional[timedelta] = None
14
+ __status: Optional[Status] = None
15
+ __message: Optional[str] = None
16
+ __trace: Optional[str] = None
17
+ __is_flaky: Optional[bool] = None
18
+
19
+ def __init__(self, name, name_space, class_name, duration):
20
+ self.__name = name
21
+ self.__name_space = name_space
22
+ self.__class_name = class_name
23
+ self.__duration = timedelta(seconds=float(duration))
24
+ self.__status = Status.PASSED
25
+ self.__trace = ""
26
+
27
+ def get_name(self) -> Optional[str]:
28
+ return self.__name
29
+
30
+ def get_name_space(self) -> Optional[str]:
31
+ return self.__name_space
32
+
33
+ def get_class_name(self) -> Optional[str]:
34
+ return self.__class_name
35
+
36
+ def get_duration(self) -> Optional[float]:
37
+ return self.__duration.total_seconds()
38
+
39
+ def get_message(self) -> Optional[str]:
40
+ return self.__message
41
+
42
+ def set_message(self, value: str) -> None:
43
+ self.__message = value
44
+
45
+ def get_trace(self) -> Optional[str]:
46
+ return self.__trace
47
+
48
+ def set_trace(self, value: str) -> None:
49
+ self.__trace = value
50
+
51
+ def get_status(self) -> AvailableTestResultOutcome:
52
+ return AvailableTestResultOutcome(self.__status.value)
53
+
54
+ def set_status(self, value: Status) -> None:
55
+ self.__status = value
56
+
57
+ def get_is_flaky(self) -> Optional[bool]:
58
+ return self.__is_flaky
59
+
60
+ def set_is_flaky(self, value: bool) -> None:
61
+ self.__is_flaky = value
@@ -0,0 +1,16 @@
1
+ from dataclasses import dataclass
2
+ from typing import List
3
+ from testit_api_client.model.assign_attachment_api_model import AssignAttachmentApiModel
4
+ from testit_api_client.model.link_put_model import LinkPutModel
5
+
6
+
7
+ @dataclass
8
+ class TestRun:
9
+ id: str
10
+ project_id: str
11
+ state: str
12
+ name: str
13
+ description: str
14
+ launch_source: str
15
+ attachments: List[AssignAttachmentApiModel]
16
+ links: List[LinkPutModel]
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import typing
2
3
  from xml.dom import minidom
3
4
 
4
5
  from .models.config import Config
@@ -92,7 +93,7 @@ class Parser:
92
93
  return results
93
94
 
94
95
  @classmethod
95
- def __form_trace(cls, child_nodes: list) -> str:
96
+ def __form_trace(cls, child_nodes: list[typing.Any]) -> str:
96
97
  trace = ""
97
98
 
98
99
  for child in child_nodes:
@@ -104,9 +105,9 @@ class Parser:
104
105
  return trace
105
106
 
106
107
  @classmethod
107
- def __get_testcases(cls, xml) -> list:
108
+ def __get_testcases(cls, xml: typing.Any) -> list[typing.Any]:
108
109
  for tag in cls.__TAGS_OF_TESTS:
109
- testcases = xml.getElementsByTagName(tag)
110
+ testcases: list[typing.Any] = xml.getElementsByTagName(tag)
110
111
 
111
112
  if testcases:
112
113
  return testcases
@@ -1,6 +1,10 @@
1
1
  import logging
2
2
 
3
+ from testit_api_client.model.assign_attachment_api_model import AssignAttachmentApiModel
4
+ from testit_api_client.model.attachment_put_model import AttachmentPutModel
5
+
3
6
  from .autotests_filter import AutotestsFilter
7
+ from .converter import Converter
4
8
  from .models.config import Config
5
9
  from .models.testrun import TestRun
6
10
  from .parser import Parser
@@ -54,7 +58,7 @@ class Service:
54
58
  self.__config.testrun_name
55
59
  )
56
60
 
57
- def __upload_attachments(self) -> list:
61
+ def __upload_attachments(self) -> list[AttachmentPutModel]:
58
62
  files = []
59
63
 
60
64
  for path_to_attachments in self.__config.paths_to_attachments:
@@ -82,11 +86,13 @@ class Service:
82
86
 
83
87
  logging.info("Successfully sent test results")
84
88
 
85
- def __update_test_run_with_attachments(self, test_run: TestRun):
86
- test_run.attachments.extend(self.__upload_attachments())
89
+ def __update_test_run_with_attachments(self, test_run: TestRun) -> None:
90
+ attachments: list[AssignAttachmentApiModel] = Converter.attachment_put_models_to_assign_attachments(
91
+ self.__upload_attachments())
92
+ test_run.attachments.extend(attachments)
87
93
  self.__api_client.update_test_run(test_run)
88
94
 
89
- def __write_to_output(self, content: str):
95
+ def __write_to_output(self, content: str) -> None:
90
96
  DirWorker.create_dir(self.__config.output)
91
97
 
92
98
  with open(self.__config.output, "w", encoding="utf-8") as text_file:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-cli
3
- Version: 2.4.11.post540
3
+ Version: 2.5.0
4
4
  Summary: This tool is the command line wrapper of Test IT allowing you to upload the test results in real time to Test IT
5
5
  Home-page: https://pypi.org/project/testit-cli/
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
  License-File: LICENSE
19
- Requires-Dist: testit-api-client==6.3.1.post540
19
+ Requires-Dist: testit-api-client==7.0.1
20
20
  Requires-Dist: validators
21
21
  Requires-Dist: tqdm
22
22
  Requires-Dist: click~=8.0.4
@@ -54,4 +54,4 @@ You can see more information in [official documentation](https://docs.testit.sof
54
54
  | 5.2.3 | 2.3.0.post523 |
55
55
  | 5.3 | 2.4.5.post530 |
56
56
  | 5.4 | 2.4.11.post540 |
57
- | Cloud | 2.4.10 |
57
+ | Cloud | 2.4.11 |
@@ -0,0 +1,4 @@
1
+ testit-api-client==7.0.1
2
+ validators
3
+ tqdm
4
+ click~=8.0.4
@@ -1,60 +0,0 @@
1
- from datetime import timedelta
2
-
3
- from testit_api_client.models import AvailableTestResultOutcome
4
-
5
- from .status import Status
6
-
7
-
8
- class TestCase:
9
- __name: str = None
10
- __name_space: str = None
11
- __class_name: str = None
12
- __duration: timedelta = None
13
- __status: Status = None
14
- __message: str = None
15
- __trace: str = None
16
- __is_flaky: bool = None
17
-
18
- def __init__(self, name, name_space, class_name, duration):
19
- self.__name = name
20
- self.__name_space = name_space
21
- self.__class_name = class_name
22
- self.__duration = timedelta(seconds=float(duration))
23
- self.__status = Status.PASSED
24
- self.__trace = ""
25
-
26
- def get_name(self):
27
- return self.__name
28
-
29
- def get_name_space(self):
30
- return self.__name_space
31
-
32
- def get_class_name(self):
33
- return self.__class_name
34
-
35
- def get_duration(self):
36
- return self.__duration.total_seconds()
37
-
38
- def get_message(self):
39
- return self.__message
40
-
41
- def set_message(self, value: str):
42
- self.__message = value
43
-
44
- def get_trace(self):
45
- return self.__trace
46
-
47
- def set_trace(self, value: str):
48
- self.__trace = value
49
-
50
- def get_status(self):
51
- return AvailableTestResultOutcome(self.__status.value)
52
-
53
- def set_status(self, value: Status):
54
- self.__status = value
55
-
56
- def get_is_flaky(self) -> bool:
57
- return self.__is_flaky
58
-
59
- def set_is_flaky(self, value: bool):
60
- self.__is_flaky = value
@@ -1,13 +0,0 @@
1
- from dataclasses import dataclass
2
-
3
-
4
- @dataclass
5
- class TestRun:
6
- id: str
7
- project_id: str
8
- state: str
9
- name: str
10
- description: str
11
- launch_source: str
12
- attachments: list
13
- links: list
@@ -1,4 +0,0 @@
1
- testit-api-client==6.3.1.post540
2
- validators
3
- tqdm
4
- click~=8.0.4
File without changes