qase-python-commons 5.1.5__tar.gz → 5.1.6__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 (54) hide show
  1. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/PKG-INFO +1 -1
  2. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/pyproject.toml +1 -1
  3. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/client/api_v1_client.py +2 -2
  4. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/client/api_v2_client.py +2 -2
  5. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/reporters/testops.py +2 -8
  6. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/reporters/testops_multi.py +2 -8
  7. qase_python_commons-5.1.6/src/qase/commons/util/api_host.py +24 -0
  8. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase_python_commons.egg-info/PKG-INFO +1 -1
  9. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase_python_commons.egg-info/SOURCES.txt +1 -0
  10. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/README.md +0 -0
  11. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/setup.cfg +0 -0
  12. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/__init__.py +0 -0
  13. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/__init__.py +0 -0
  14. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/client/base_api_client.py +0 -0
  15. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/config.py +0 -0
  16. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/exceptions/reporter.py +0 -0
  17. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/loader.py +0 -0
  18. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/logger.py +0 -0
  19. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/__init__.py +0 -0
  20. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/attachment.py +0 -0
  21. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/basemodel.py +0 -0
  22. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/api.py +0 -0
  23. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/batch.py +0 -0
  24. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/connection.py +0 -0
  25. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/framework.py +0 -0
  26. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/plan.py +0 -0
  27. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/qaseconfig.py +0 -0
  28. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/report.py +0 -0
  29. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/run.py +0 -0
  30. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/config/testops.py +0 -0
  31. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/external_link.py +0 -0
  32. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/relation.py +0 -0
  33. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/result.py +0 -0
  34. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/run.py +0 -0
  35. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/runtime.py +0 -0
  36. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/models/step.py +0 -0
  37. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/profilers/__init__.py +0 -0
  38. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/profilers/db.py +0 -0
  39. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/profilers/network.py +0 -0
  40. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/profilers/sleep.py +0 -0
  41. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/reporters/__init__.py +0 -0
  42. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/reporters/core.py +0 -0
  43. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/reporters/report.py +0 -0
  44. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/retry.py +0 -0
  45. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/status_mapping/__init__.py +0 -0
  46. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/status_mapping/status_mapping.py +0 -0
  47. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/util/__init__.py +0 -0
  48. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/util/host_data.py +0 -0
  49. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/util/token_masker.py +0 -0
  50. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/utils.py +0 -0
  51. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase/commons/validators/base.py +0 -0
  52. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase_python_commons.egg-info/dependency_links.txt +0 -0
  53. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase_python_commons.egg-info/requires.txt +0 -0
  54. {qase_python_commons-5.1.5 → qase_python_commons-5.1.6}/src/qase_python_commons.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qase-python-commons
3
- Version: 5.1.5
3
+ Version: 5.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/main/qase-python-commons
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qase-python-commons"
7
- version = "5.1.5"
7
+ version = "5.1.6"
8
8
  description = "A library for Qase TestOps and Qase Report"
9
9
  readme = "README.md"
10
10
  authors = [{name = "Qase Team", email = "support@qase.io"}]
@@ -9,6 +9,7 @@ from qase.api_client_v1.configuration import Configuration
9
9
  from .. import Logger
10
10
  from .base_api_client import BaseApiClient
11
11
  from ..retry import send_with_retry
12
+ from ..util.api_host import get_web_app_url
12
13
  from ..exceptions.reporter import ReporterException
13
14
  from ..models import Attachment
14
15
  from ..models.config.framework import Video, Trace
@@ -31,12 +32,11 @@ class ApiV1Client(BaseApiClient):
31
32
  # pinned off so it cannot multiply with the application-level one.
32
33
  configuration.retries = 0
33
34
  host = self.config.testops.api.host
35
+ self.web = get_web_app_url(host)
34
36
  if host == 'qase.io':
35
37
  configuration.host = f'https://api.{host}/v1'
36
- self.web = f'https://app.{host}'
37
38
  else:
38
39
  configuration.host = f'https://api-{host}/v1'
39
- self.web = f'https://{host}'
40
40
 
41
41
  self.client = ApiClient(configuration)
42
42
  self.logger.log_debug("API client prepared")
@@ -20,6 +20,7 @@ from ..models.config.framework import Video, Trace
20
20
  from ..models import Attachment, Result
21
21
  from ..models.config.qaseconfig import QaseConfig
22
22
  from ..models.step import StepType, Step
23
+ from ..util.api_host import get_web_app_url
23
24
  from ..util.host_data import HostData
24
25
 
25
26
 
@@ -42,12 +43,11 @@ class ApiV2Client(ApiV1Client):
42
43
  # 9 requests, the opposite of what is wanted on a 429.
43
44
  configuration.retries = 0
44
45
  host = self.config.testops.api.host
46
+ self.web = get_web_app_url(host)
45
47
  if host == 'qase.io':
46
48
  configuration.host = f'https://api.{host}/v2'
47
- self.web = f'https://app.{host}'
48
49
  else:
49
50
  configuration.host = f'https://api-{host}/v2'
50
- self.web = f'https://{host}'
51
51
 
52
52
  self.client_v2 = ApiClient(configuration)
53
53
 
@@ -9,6 +9,7 @@ from ..client.base_api_client import BaseApiClient
9
9
  from ..models import Result
10
10
  from ..models.config.qaseconfig import QaseConfig
11
11
  from ..retry import send_with_retry
12
+ from ..util.api_host import get_web_app_url
12
13
 
13
14
  DEFAULT_BATCH_SIZE = 200
14
15
  DEFAULT_THREAD_COUNT = 4
@@ -20,7 +21,7 @@ class QaseTestOps:
20
21
  def __init__(self, config: QaseConfig, logger: Logger, client: BaseApiClient) -> None:
21
22
  self.config = config
22
23
  self.logger = logger
23
- self.__baseUrl = self.__get_host(config.testops.api.host)
24
+ self.__baseUrl = get_web_app_url(config.testops.api.host)
24
25
  self.client = client
25
26
 
26
27
  run_id = self.config.testops.run.id
@@ -210,10 +211,3 @@ class QaseTestOps:
210
211
  if ids is not None and len(ids) > 0:
211
212
  return f"{link}{self.project_code}-{ids[0]}"
212
213
  return f"{link}{urllib.parse.quote_plus(title)}"
213
-
214
- @staticmethod
215
- def __get_host(host: str):
216
- if host == 'qase.io':
217
- return 'https://app.qase.io'
218
-
219
- return f'https://{host.replace("api", "app")}'
@@ -10,6 +10,7 @@ from ..client.base_api_client import BaseApiClient
10
10
  from ..models import Result
11
11
  from ..models.config.qaseconfig import QaseConfig
12
12
  from ..retry import send_with_retry
13
+ from ..util.api_host import get_web_app_url
13
14
 
14
15
  DEFAULT_BATCH_SIZE = 200
15
16
  DEFAULT_THREAD_COUNT = 4
@@ -21,7 +22,7 @@ class QaseTestOpsMulti:
21
22
  def __init__(self, config: QaseConfig, logger: Logger, client: BaseApiClient) -> None:
22
23
  self.config = config
23
24
  self.logger = logger
24
- self.__baseUrl = self.__get_host(config.testops.api.host)
25
+ self.__baseUrl = get_web_app_url(config.testops.api.host)
25
26
  self.client = client
26
27
 
27
28
  self.multi_config = config.testops_multi
@@ -369,10 +370,3 @@ class QaseTestOpsMulti:
369
370
  if ids is not None and len(ids) > 0:
370
371
  return f"{link}{project_code}-{ids[0]}"
371
372
  return f"{link}{urllib.parse.quote_plus(title)}"
372
-
373
- @staticmethod
374
- def __get_host(host: str):
375
- """Get host URL for Qase."""
376
- if host == 'qase.io':
377
- return 'https://app.qase.io'
378
- return f'https://{host.replace("api", "app")}'
@@ -0,0 +1,24 @@
1
+ from typing import Optional
2
+
3
+ DEFAULT_HOST = 'qase.io'
4
+
5
+ # Enterprise hosts share the `api-<name>.qase.io` shape but serve the web app on
6
+ # `<name>.qase.io`, so a cluster cannot be inferred from the API hostname and has
7
+ # to be listed explicitly.
8
+ CLUSTER_APP_HOSTS = {
9
+ 'api-eu.qase.io': 'app-eu.qase.io',
10
+ }
11
+
12
+
13
+ def resolve_cluster_app_url(host: str) -> Optional[str]:
14
+ """Return the web app URL of a known Qase cluster, or None for any other host."""
15
+ # Mirrors how a host fragment becomes the API base URL: `https://api-<host>`.
16
+ app_host = CLUSTER_APP_HOSTS.get(f'api-{host}'.lower())
17
+ return f'https://{app_host}' if app_host else None
18
+
19
+
20
+ def get_web_app_url(host: str) -> str:
21
+ """Return the Qase web app base URL for the `testops.api.host` value."""
22
+ if host == DEFAULT_HOST:
23
+ return f'https://app.{DEFAULT_HOST}'
24
+ return resolve_cluster_app_url(host) or f'https://{host}'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qase-python-commons
3
- Version: 5.1.5
3
+ Version: 5.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/main/qase-python-commons
@@ -41,6 +41,7 @@ src/qase/commons/reporters/testops_multi.py
41
41
  src/qase/commons/status_mapping/__init__.py
42
42
  src/qase/commons/status_mapping/status_mapping.py
43
43
  src/qase/commons/util/__init__.py
44
+ src/qase/commons/util/api_host.py
44
45
  src/qase/commons/util/host_data.py
45
46
  src/qase/commons/util/token_masker.py
46
47
  src/qase/commons/validators/base.py