testit-python-commons 3.6.1.post530__tar.gz → 3.6.3__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 (42) hide show
  1. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/PKG-INFO +2 -2
  2. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/setup.py +2 -2
  3. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/client/api_client.py +9 -10
  4. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
  5. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons.egg-info/SOURCES.txt +3 -1
  6. testit_python_commons-3.6.3/src/testit_python_commons.egg-info/requires.txt +2 -0
  7. testit_python_commons-3.6.3/tests/test_app_properties.py +105 -0
  8. testit_python_commons-3.6.3/tests/test_dynamic_methods.py +84 -0
  9. testit_python_commons-3.6.1.post530/src/testit_python_commons.egg-info/requires.txt +0 -2
  10. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/README.md +0 -0
  11. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/setup.cfg +0 -0
  12. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit.py +0 -0
  13. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/__init__.py +0 -0
  14. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/app_properties.py +0 -0
  15. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/client/__init__.py +0 -0
  16. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/client/client_configuration.py +0 -0
  17. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/client/converter.py +0 -0
  18. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/decorators.py +0 -0
  19. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/dynamic_methods.py +0 -0
  20. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/__init__.py +0 -0
  21. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/adapter_mode.py +0 -0
  22. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/fixture.py +0 -0
  23. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/link.py +0 -0
  24. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/link_type.py +0 -0
  25. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/outcome_type.py +0 -0
  26. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/step_result.py +0 -0
  27. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/test_result.py +0 -0
  28. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
  29. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/__init__.py +0 -0
  30. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/adapter_manager.py +0 -0
  31. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
  32. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/fixture_manager.py +0 -0
  33. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/fixture_storage.py +0 -0
  34. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/logger.py +0 -0
  35. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/plugin_manager.py +0 -0
  36. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/retry.py +0 -0
  37. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/step_manager.py +0 -0
  38. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/step_result_storage.py +0 -0
  39. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/services/utils.py +0 -0
  40. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons/step.py +0 -0
  41. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
  42. {testit_python_commons-3.6.1.post530 → testit_python_commons-3.6.3}/src/testit_python_commons.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 3.6.1.post530
3
+ Version: 3.6.3
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
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
  Requires-Dist: pluggy
19
- Requires-Dist: testit-api-client==6.0.1.post530
19
+ Requires-Dist: testit-api-client==6.2.0
20
20
  Dynamic: author
21
21
  Dynamic: author-email
22
22
  Dynamic: classifier
@@ -1,6 +1,6 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
- VERSION = "3.6.1.post530"
3
+ VERSION = "3.6.3"
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', 'testit-api-client==6.0.1.post530']
28
+ install_requires=['pluggy', 'testit-api-client==6.2.0']
29
29
  )
@@ -375,9 +375,9 @@ class ApiClientWorker:
375
375
  model = Converter.convert_test_result_model_to_test_results_id_put_request(
376
376
  self.get_test_result_by_id(test_result.get_test_result_id()))
377
377
 
378
- model.setup_results = Converter.step_results_to_attachment_put_model_autotest_step_results_model(
378
+ model.setup_results = Converter.step_results_to_auto_test_step_result_update_request(
379
379
  test_result.get_setup_results())
380
- model.teardown_results = Converter.step_results_to_attachment_put_model_autotest_step_results_model(
380
+ model.teardown_results = Converter.step_results_to_auto_test_step_result_update_request(
381
381
  test_result.get_teardown_results())
382
382
 
383
383
  try:
@@ -393,16 +393,15 @@ class ApiClientWorker:
393
393
 
394
394
  for path in attach_paths:
395
395
  if os.path.isfile(path):
396
- with open(path, "rb+") as file:
397
- try:
398
- attachment_response = self.__attachments_api.api_v2_attachments_post(
399
- file=(file.name, file.read()))
396
+ try:
397
+ attachment_response = self.__attachments_api.api_v2_attachments_post(
398
+ file=path)
400
399
 
401
- attachments.append(AttachmentPutModel(id=attachment_response.id))
400
+ attachments.append(AttachmentPutModel(id=attachment_response.id))
402
401
 
403
- logging.debug(f'Attachment "{path}" was uploaded')
404
- except Exception as exc:
405
- logging.error(f'Upload attachment "{path}" status: {exc}')
402
+ logging.debug(f'Attachment "{path}" was uploaded')
403
+ except Exception as exc:
404
+ logging.error(f'Upload attachment "{path}" status: {exc}')
406
405
  else:
407
406
  logging.error(f'File "{path}" was not found!')
408
407
  return attachments
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testit-python-commons
3
- Version: 3.6.1.post530
3
+ Version: 3.6.3
4
4
  Summary: Python commons for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
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
  Requires-Dist: pluggy
19
- Requires-Dist: testit-api-client==6.0.1.post530
19
+ Requires-Dist: testit-api-client==6.2.0
20
20
  Dynamic: author
21
21
  Dynamic: author-email
22
22
  Dynamic: classifier
@@ -34,4 +34,6 @@ src/testit_python_commons/services/plugin_manager.py
34
34
  src/testit_python_commons/services/retry.py
35
35
  src/testit_python_commons/services/step_manager.py
36
36
  src/testit_python_commons/services/step_result_storage.py
37
- src/testit_python_commons/services/utils.py
37
+ src/testit_python_commons/services/utils.py
38
+ tests/test_app_properties.py
39
+ tests/test_dynamic_methods.py
@@ -0,0 +1,2 @@
1
+ pluggy
2
+ testit-api-client==6.2.0
@@ -0,0 +1,105 @@
1
+ import random
2
+ import string
3
+ import os
4
+ import uuid
5
+ import pytest
6
+
7
+ from testit_python_commons.app_properties import AppProperties
8
+
9
+ class TestAppProperties:
10
+ __properties_file = AppProperties._AppProperties__properties_file
11
+ __env_prefix = AppProperties._AppProperties__env_prefix
12
+
13
+ @pytest.fixture
14
+ def create_config_file(self, tmp_path):
15
+ def _create_config_file(filename, content):
16
+ file_path = tmp_path / filename
17
+ file_path.write_text(content, encoding="utf-8")
18
+ return file_path
19
+
20
+ return _create_config_file
21
+
22
+ @pytest.fixture
23
+ def properties(self):
24
+ return {
25
+ 'url': "https://www.example.com",
26
+ 'privatetoken': ''.join(random.choices(string.ascii_letters + string.digits, k=24)),
27
+ 'projectid': str(uuid.uuid4()),
28
+ 'configurationid': str(uuid.uuid4()),
29
+ 'testrunid': str(uuid.uuid4()),
30
+ 'testrunname': ''.join(random.choices(string.ascii_letters + string.digits, k=10)),
31
+ 'adaptermode': "2",
32
+ 'tmsproxy': ''.join(random.choices(string.ascii_letters + string.digits, k=3)),
33
+ 'certvalidation': "false",
34
+ 'automaticcreationtestcases': "true",
35
+ 'automaticupdationlinkstotestcases': "true",
36
+ 'importrealtime': "false"
37
+ }
38
+
39
+ def test_load_file_properties_ini_file(self, create_config_file, tmp_path, mocker):
40
+ mocker.patch.object(os.path, 'abspath', return_value=str(tmp_path))
41
+ mocker.patch.dict(os.environ, clear=True)
42
+
43
+ properties_testit = {
44
+ 'url': 'https://www.example.com',
45
+ 'privatetoken': ''.join(random.choices(string.ascii_letters + string.digits, k=24)),
46
+ 'projectid': str(uuid.uuid4()),
47
+ 'configurationid': str(uuid.uuid4()),
48
+ 'testrunid': str(uuid.uuid4()),
49
+ 'testrunname': ''.join(random.choices(string.ascii_letters + string.digits, k=10)),
50
+ 'adaptermode': "2"
51
+ }
52
+
53
+ properties_debug = {
54
+ 'tmsproxy': ''.join(random.choices(string.ascii_letters + string.digits, k=3)),
55
+ 'logs': 'true'
56
+ }
57
+
58
+ config_content = "[testit]\n"
59
+ for property in properties_testit:
60
+ config_content += "%s=%s\n" % (property, properties_testit[property])
61
+ config_content += "[debug]\n"
62
+ config_content += "tmsProxy=%s\n" % properties_debug['tmsproxy']
63
+ config_content += "__dev=%s\n" % properties_debug['logs']
64
+
65
+ create_config_file(self.__properties_file, config_content)
66
+ mocker.patch('os.path.isfile', lambda p: p == str(tmp_path / self.__properties_file))
67
+ assert AppProperties.load_file_properties() == {**properties_testit, **properties_debug}
68
+
69
+ def test_load_env_properties_all_set(self, properties, mocker):
70
+ env_vars = {
71
+ f"{self.__env_prefix}_URL": properties["url"],
72
+ f"{self.__env_prefix}_PRIVATE_TOKEN": properties["privatetoken"],
73
+ f"{self.__env_prefix}_PROJECT_ID": properties["projectid"],
74
+ f"{self.__env_prefix}_CONFIGURATION_ID": properties["configurationid"],
75
+ f"{self.__env_prefix}_TEST_RUN_ID": properties["testrunid"],
76
+ f"{self.__env_prefix}_TEST_RUN_NAME": properties["testrunname"],
77
+ f"{self.__env_prefix}_ADAPTER_MODE": properties["adaptermode"],
78
+ f"{self.__env_prefix}_PROXY": properties["tmsproxy"],
79
+ f"{self.__env_prefix}_CERT_VALIDATION": properties["certvalidation"],
80
+ f"{self.__env_prefix}_AUTOMATIC_CREATION_TEST_CASES": properties["automaticcreationtestcases"],
81
+ f"{self.__env_prefix}_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES": properties["automaticupdationlinkstotestcases"],
82
+ f"{self.__env_prefix}_IMPORT_REALTIME": properties["importrealtime"],
83
+ }
84
+ mocker.patch.dict(os.environ, env_vars, clear=True)
85
+
86
+ assert AppProperties.load_env_properties() == properties
87
+
88
+ def test_load_cli_properties_all_set(self, properties, mocker):
89
+ mock_options = mocker.MagicMock()
90
+ mock_options.set_url = properties["url"]
91
+ mock_options.set_private_token = properties["privatetoken"]
92
+ mock_options.set_project_id = properties["projectid"]
93
+ mock_options.set_configuration_id = properties["configurationid"]
94
+ mock_options.set_test_run_id = properties["testrunid"]
95
+ mock_options.set_test_run_name = properties["testrunname"]
96
+ mock_options.set_adapter_mode = properties["adaptermode"]
97
+ mock_options.set_tms_proxy = properties["tmsproxy"]
98
+ mock_options.set_cert_validation = properties["certvalidation"]
99
+ mock_options.set_automatic_creation_test_cases = properties["automaticcreationtestcases"]
100
+ mock_options.set_automatic_updation_links_to_test_cases = properties["automaticupdationlinkstotestcases"]
101
+ mock_options.set_import_realtime = properties["importrealtime"]
102
+
103
+ assert AppProperties.load_cli_properties(mock_options) == properties
104
+
105
+
@@ -0,0 +1,84 @@
1
+ import random
2
+ import string
3
+ import pytest
4
+
5
+ from testit_python_commons import dynamic_methods
6
+ from testit_python_commons.services import TmsPluginManager, Utils
7
+ from testit_python_commons.models.link_type import LinkType
8
+ from testit_python_commons.models.link import Link
9
+
10
+
11
+ class TestDynamicMethods:
12
+ @pytest.fixture
13
+ def link_model(self) -> Link:
14
+ return Utils.convert_link_dict_to_link_model({
15
+ "url": "https://www.example.com",
16
+ "title": ''.join(random.choices(string.ascii_letters + string.digits, k=10)),
17
+ "type": LinkType.ISSUE,
18
+ "description": ''.join(random.choices(string.ascii_letters + string.digits, k=10))
19
+ })
20
+
21
+ @pytest.fixture
22
+ def mock_plugin_manager_hook(self, mocker):
23
+ mock_plugin_manager = mocker.patch.object(TmsPluginManager, 'get_plugin_manager')
24
+ mock_hook = mock_plugin_manager.return_value.hook
25
+
26
+ return mock_hook
27
+
28
+ def test_add_link_deprecated(self, link_model, mock_plugin_manager_hook, mocker):
29
+ mock_convert = mocker.patch.object(Utils, 'convert_link_dict_to_link_model')
30
+ mock_convert.return_value = link_model
31
+
32
+ dynamic_methods.addLink(
33
+ url=link_model.get_url(),
34
+ title=link_model.get_title(),
35
+ type=link_model.get_link_type(),
36
+ description=link_model.get_description()
37
+ )
38
+
39
+ mock_plugin_manager_hook.add_link.assert_called_once_with(link=link_model)
40
+ mock_convert.assert_called_once_with({
41
+ "url": link_model.get_url(),
42
+ "title": link_model.get_title(),
43
+ "type": link_model.get_link_type(),
44
+ "description": link_model.get_description()
45
+ })
46
+
47
+ def test_add_links_with_url(self, link_model, mock_plugin_manager_hook, mocker):
48
+ mock_convert = mocker.patch.object(Utils, 'convert_link_dict_to_link_model')
49
+ mock_convert.return_value = link_model
50
+
51
+ dynamic_methods.addLinks(
52
+ url=link_model.get_url(),
53
+ title=link_model.get_title(),
54
+ type=link_model.get_link_type(),
55
+ description=link_model.get_description()
56
+ )
57
+
58
+ mock_plugin_manager_hook.add_link.assert_called_once_with(link=link_model)
59
+ mock_convert.assert_called_once_with({
60
+ "url": link_model.get_url(),
61
+ "title": link_model.get_title(),
62
+ "type": link_model.get_link_type(),
63
+ "description": link_model.get_description()
64
+ })
65
+
66
+ def test_add_links_with_list(self, link_model, mock_plugin_manager_hook, mocker):
67
+ mock_convert = mocker.patch.object(Utils, 'convert_link_dict_to_link_model')
68
+ mock_convert.return_value = link_model
69
+
70
+ link_data = {
71
+ "url": link_model.get_url(),
72
+ "title": link_model.get_title(),
73
+ "type": link_model.get_link_type(),
74
+ "description": link_model.get_description()
75
+ }
76
+ dynamic_methods.addLinks(links=[link_data])
77
+
78
+ mock_plugin_manager_hook.add_link.assert_called_once_with(link=link_model)
79
+ mock_convert.assert_called_once_with(link_data)
80
+
81
+ def test_add_message(self, mock_plugin_manager_hook):
82
+ test_message = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
83
+ dynamic_methods.addMessage(test_message)
84
+ mock_plugin_manager_hook.add_message.assert_called_once_with(test_message=test_message)
@@ -1,2 +0,0 @@
1
- pluggy
2
- testit-api-client==6.0.1.post530