qase-python-commons 3.1.4__py3-none-any.whl → 3.1.6__py3-none-any.whl

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.

Potentially problematic release.


This version of qase-python-commons might be problematic. Click here for more details.

@@ -2,7 +2,7 @@ from typing import Dict, Union
2
2
 
3
3
  import certifi
4
4
  from qase.api_client_v1 import ApiClient, ProjectsApi, Project, EnvironmentsApi, RunsApi, AttachmentsApi, \
5
- AttachmentGet, RunCreate, ResultsApi, ResultcreateBulk
5
+ AttachmentGet, RunCreate, ResultsApi, ResultcreateBulk, AuthorsApi
6
6
  from qase.api_client_v1.configuration import Configuration
7
7
  from .. import Logger
8
8
  from .base_api_client import BaseApiClient
@@ -16,6 +16,7 @@ class ApiV1Client(BaseApiClient):
16
16
  def __init__(self, config: QaseConfig, logger: Logger):
17
17
  self.logger = logger
18
18
  self.config = config
19
+ self.__authors = {}
19
20
 
20
21
  try:
21
22
  self.logger.log_debug("Preparing API client")
@@ -87,8 +88,8 @@ class ApiV1Client(BaseApiClient):
87
88
  return response.result
88
89
 
89
90
  except Exception as e:
90
- self.logger.log(f"Error at uploading attachment: {e}", "error")
91
- raise ReporterException(e)
91
+ self.logger.log(f"Error at uploading attachment: {e}", "debug")
92
+ return None
92
93
 
93
94
  def create_test_run(self, project_code: str, title: str, description: str, plan_id=None,
94
95
  environment_id=None) -> str:
@@ -138,7 +139,9 @@ class ApiV1Client(BaseApiClient):
138
139
  attached = []
139
140
  if result.attachments:
140
141
  for attachment in result.attachments:
141
- attached.extend(self._upload_attachment(project_code, attachment))
142
+ attach_id = self._upload_attachment(project_code, attachment)
143
+ if attach_id:
144
+ attached.append(attach_id)
142
145
 
143
146
  steps = []
144
147
  for step in result.steps:
@@ -198,6 +201,11 @@ class ApiV1Client(BaseApiClient):
198
201
  if test_ops_id:
199
202
  result_model["case_id"] = test_ops_id
200
203
 
204
+ if result.get_field('author'):
205
+ author_id = self._get_author_id(result.get_field('author'))
206
+ if author_id:
207
+ result_model["author_id"] = author_id
208
+
201
209
  self.logger.log_debug(f"Prepared result: {result_model}")
202
210
 
203
211
  return result_model
@@ -246,7 +254,9 @@ class ApiV1Client(BaseApiClient):
246
254
  if step.attachments:
247
255
  uploaded_attachments = []
248
256
  for file in step.attachments:
249
- uploaded_attachments.extend(self._upload_attachment(project_code, file))
257
+ attach_id = self._upload_attachment(project_code, file)
258
+ if attach_id:
259
+ uploaded_attachments.append(attach_id)
250
260
  prepared_step['attachments'] = [attach.hash for attach in uploaded_attachments]
251
261
 
252
262
  if step.steps:
@@ -257,3 +267,16 @@ class ApiV1Client(BaseApiClient):
257
267
  except Exception as e:
258
268
  self.logger.log(f"Error at preparing step: {e}", "error")
259
269
  raise ReporterException(e)
270
+
271
+ def _get_author_id(self, author: str) -> Union[str, None]:
272
+ if author in self.__authors:
273
+ return self.__authors[author]
274
+
275
+ author_api = AuthorsApi(self.client)
276
+ authors = author_api.get_authors(search=author)
277
+ if authors.result.total == 0:
278
+ return None
279
+
280
+ self.__authors[author] = authors.result.entities[0].author_id
281
+
282
+ return authors.result.entities[0].author_id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qase-python-commons
3
- Version: 3.1.4
3
+ Version: 3.1.6
4
4
  Summary: A library for Qase TestOps and Qase Report
5
5
  Author-email: Qase Team <support@qase.io>
6
6
  Project-URL: Homepage, https://github.com/qase-tms/qase-python/tree/master/qase-python-commons
@@ -22,7 +22,7 @@ Requires-Python: >=3.7
22
22
  Description-Content-Type: text/markdown
23
23
  Requires-Dist: certifi>=2024.2.2
24
24
  Requires-Dist: attrs>=23.2.0
25
- Requires-Dist: qase-api-client~=1.1.0
25
+ Requires-Dist: qase-api-client~=1.1.1
26
26
  Requires-Dist: qase-api-v2-client~=1.0.0
27
27
  Requires-Dist: more-itertools
28
28
  Provides-Extra: testing
@@ -3,7 +3,7 @@ qase/commons/config.py,sha256=meRRgDrsA9qQ9fZR4fnP0VdngrKiGcHF9nnJkf3eJpg,8320
3
3
  qase/commons/loader.py,sha256=-MMY4HgSI6q1xq3NaJoq_w4liM73qdFKjYLVCT1E7Pc,1064
4
4
  qase/commons/logger.py,sha256=ka5chQYBXLUB5pM4YHDBo3QCZfBTGMtC3H33tI4NbPQ,1027
5
5
  qase/commons/utils.py,sha256=OOr6kQ5hPZEyHXwbwiTOTkonRxmmtkyZPPGqXQKp5vY,2799
6
- qase/commons/client/api_v1_client.py,sha256=NVluiG_pBZL4u2D34WtgXaPkA4TdJhmHUNd6rnfcDeg,11178
6
+ qase/commons/client/api_v1_client.py,sha256=_NTKXY4P34xi8UiYAyun7jB8cYjC0bNJ32SgIqo2biU,11978
7
7
  qase/commons/client/api_v2_client.py,sha256=F3wU_2EKe6eUjNRahvnDmpbx99PwZB6Lxc4VPRj7w58,7247
8
8
  qase/commons/client/base_api_client.py,sha256=H8JnjqSrBFNfghDd3T3zxYOyKYHYe9QiJQXol1JqdQk,2613
9
9
  qase/commons/exceptions/reporter.py,sha256=dP-Mwcq8HKBOjgu3YqhyULDmDGU09BmT6Fh9HjICaUc,45
@@ -34,7 +34,7 @@ qase/commons/reporters/core.py,sha256=0x5G-KVfEOWyXiXaX5__7JBIr3Rxy8vhy0cByUSZUc
34
34
  qase/commons/reporters/report.py,sha256=MPsFv3k2l4652NyXEGFiSmwsSpwZT3Is-lLRXvsniz4,4606
35
35
  qase/commons/reporters/testops.py,sha256=f5BcorFwIK5BSeA4Rv4IKDddkWrAXL_w-Y5Xn--NdYs,6264
36
36
  qase/commons/validators/base.py,sha256=wwSn-4YiuXtfGMGnSKgo9Vm5hAKevVmmfd2Ro6Q7MYQ,173
37
- qase_python_commons-3.1.4.dist-info/METADATA,sha256=8r0A6cNd5M0C7MrJ39maclb3oX3HHGmq7xipJiRsBH8,1859
38
- qase_python_commons-3.1.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
39
- qase_python_commons-3.1.4.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
- qase_python_commons-3.1.4.dist-info/RECORD,,
37
+ qase_python_commons-3.1.6.dist-info/METADATA,sha256=OBhruevZQ73M78kCWqcZfkZVUjEFcCaAyGvmZUg6sL8,1859
38
+ qase_python_commons-3.1.6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
39
+ qase_python_commons-3.1.6.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
+ qase_python_commons-3.1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5