testit-python-commons 3.2.3__tar.gz → 3.2.5__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 (36) hide show
  1. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/PKG-INFO +1 -1
  2. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/setup.py +1 -1
  3. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/dynamic_methods.py +2 -2
  4. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/adapter_manager.py +4 -2
  5. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/utils.py +24 -0
  6. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/step.py +3 -0
  7. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons.egg-info/PKG-INFO +1 -1
  8. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/README.md +0 -0
  9. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/setup.cfg +0 -0
  10. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit.py +0 -0
  11. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/__init__.py +0 -0
  12. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/app_properties.py +0 -0
  13. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/client/__init__.py +0 -0
  14. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/client/api_client.py +0 -0
  15. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/client/client_configuration.py +0 -0
  16. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/client/converter.py +0 -0
  17. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/decorators.py +0 -0
  18. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/__init__.py +0 -0
  19. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/adapter_mode.py +0 -0
  20. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/link.py +0 -0
  21. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/link_type.py +0 -0
  22. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/outcome_type.py +0 -0
  23. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/step_result.py +0 -0
  24. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/test_result.py +0 -0
  25. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  26. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/__init__.py +0 -0
  27. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  28. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/logger.py +0 -0
  29. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/plugin_manager.py +0 -0
  30. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/retry.py +0 -0
  31. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/step_manager.py +0 -0
  32. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons/services/step_result_storage.py +0 -0
  33. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
  34. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  35. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons.egg-info/requires.txt +0 -0
  36. {testit_python_commons-3.2.3 → testit_python_commons-3.2.5}/src/testit_python_commons.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-python-commons
3
- Version: 3.2.3
3
+ Version: 3.2.5
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name='testit-python-commons',
5
- version='3.2.3',
5
+ version='3.2.5',
6
6
  description='Python commons for Test IT',
7
7
  long_description=open('README.md', "r").read(),
8
8
  long_description_content_type="text/markdown",
@@ -84,7 +84,7 @@ def addAttachments(data, is_text: bool = False, name: str = None): # noqa: N80
84
84
  @adapter_logger
85
85
  def add_attachments_to_step(step, data, is_text: bool = False, name: str = None):
86
86
  if is_text:
87
- attachment_ids = TmsPluginManager.get_adapter_manager().create_attachment(str(data), name)
87
+ attachment_ids = TmsPluginManager.get_adapter_manager().create_attachment(data, name)
88
88
  else:
89
89
  if isinstance(data, str):
90
90
  attachment_ids = TmsPluginManager.get_adapter_manager().load_attachments([data])
@@ -102,7 +102,7 @@ def add_attachments_to_test(data, is_text: bool = False, name: str = None):
102
102
  if is_text and hasattr(TmsPluginManager.get_plugin_manager().hook, 'create_attachment'):
103
103
  TmsPluginManager.get_plugin_manager().hook \
104
104
  .create_attachment(
105
- body=str(data),
105
+ body=data,
106
106
  name=name)
107
107
  elif hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_attachments'):
108
108
  if isinstance(data, str):
@@ -9,6 +9,7 @@ from testit_python_commons.models.test_result import TestResult
9
9
  from testit_python_commons.models.test_result_with_all_fixture_step_results_model import TestResultWithAllFixtureStepResults
10
10
  from testit_python_commons.services.adapter_manager_configuration import AdapterManagerConfiguration
11
11
  from testit_python_commons.services.logger import adapter_logger
12
+ from testit_python_commons.services.utils import Utils
12
13
 
13
14
 
14
15
  class AdapterManager:
@@ -54,14 +55,15 @@ class AdapterManager:
54
55
  return self.__api_client.load_attachments(attach_paths)
55
56
 
56
57
  @adapter_logger
57
- def create_attachment(self, body: str, name: str):
58
+ def create_attachment(self, body, name: str):
58
59
  if name is None:
59
60
  name = str(uuid.uuid4()) + '-attachment.txt'
60
61
 
61
62
  path = os.path.join(os.path.abspath(''), name)
62
63
 
63
64
  with open(path, 'wb') as attached_file:
64
- attached_file.write(body.encode('utf-8'))
65
+ attached_file.write(
66
+ Utils.convert_body_of_attachment(body))
65
67
 
66
68
  attachment_id = self.__api_client.load_attachments((path,))
67
69
 
@@ -69,6 +69,22 @@ class Utils:
69
69
 
70
70
  return parameters
71
71
 
72
+ @staticmethod
73
+ def collect_parameters_in_string_attribute(attribute: str, all_parameters: dict) -> str:
74
+ param_keys = []
75
+
76
+ if attribute:
77
+ param_keys = re.findall(r"\{(.*?)\}", attribute)
78
+
79
+ if len(param_keys) > 0:
80
+ for param_key in param_keys:
81
+ parameter = all_parameters.get(param_key)
82
+
83
+ if parameter is not None:
84
+ attribute = attribute.replace("{" + param_key + "}", str(parameter))
85
+
86
+ return attribute
87
+
72
88
  @staticmethod
73
89
  @adapter_logger
74
90
  def convert_link_dict_to_link_model(link_dict: dict) -> Link:
@@ -85,3 +101,11 @@ class Utils:
85
101
  link_model.set_description(link_dict['description'])
86
102
 
87
103
  return link_model
104
+
105
+ @staticmethod
106
+ @adapter_logger
107
+ def convert_body_of_attachment(body):
108
+ if isinstance(body, bytes):
109
+ return body
110
+
111
+ return str(body).encode('utf-8')
@@ -55,6 +55,9 @@ class StepContext:
55
55
  self.__start_time = round(datetime.utcnow().timestamp() * 1000)
56
56
  self.__step_result = StepResult()
57
57
 
58
+ self.__title = Utils.collect_parameters_in_string_attribute(self.__title, self.__parameters)
59
+ self.__description = Utils.collect_parameters_in_string_attribute(self.__description, self.__parameters)
60
+
58
61
  self.__step_result\
59
62
  .set_title(self.__title)\
60
63
  .set_description(self.__description)\
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-python-commons
3
- Version: 3.2.3
3
+ Version: 3.2.5
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team