diff --git a/src/frostfs_testlib/analytics/__init__.py b/src/frostfs_testlib/analytics/__init__.py index c670d1de..6995a08a 100644 --- a/src/frostfs_testlib/analytics/__init__.py +++ b/src/frostfs_testlib/analytics/__init__.py @@ -1,4 +1,5 @@ -from test_case import id, suite_name, suite_section, title -from test_collector import TestCase, TestCaseCollector -from test_exporter import TestExporter -from testrail_exporter import TestrailExporter \ No newline at end of file +from frostfs_testlib.analytics import test_case +from frostfs_testlib.analytics.test_case import TestCasePriority +from frostfs_testlib.analytics.test_collector import TestCase, TestCaseCollector +from frostfs_testlib.analytics.test_exporter import TestExporter +from frostfs_testlib.analytics.testrail_exporter import TestrailExporter diff --git a/src/frostfs_testlib/analytics/test_exporter.py b/src/frostfs_testlib/analytics/test_exporter.py index 77db0a29..2af3f060 100644 --- a/src/frostfs_testlib/analytics/test_exporter.py +++ b/src/frostfs_testlib/analytics/test_exporter.py @@ -1,6 +1,7 @@ from abc import ABC, abstractmethod -from test_collector import TestCase +from frostfs_testlib.analytics.test_collector import TestCase + class TestExporter(ABC): test_cases_cache = [] @@ -45,7 +46,9 @@ class TestExporter(ABC): """ @abstractmethod - def update_test_case(self, test_case: TestCase, test_case_in_tms, test_suite, test_suite_section) -> None: + def update_test_case( + self, test_case: TestCase, test_case_in_tms, test_suite, test_suite_section + ) -> None: """ Update test case in TMS """ @@ -57,14 +60,13 @@ class TestExporter(ABC): for test_case in test_cases: test_suite = self.get_or_create_test_suite(test_case.suite_name) - test_section = self.get_or_create_suite_section(test_suite, test_case.suite_section_name) + test_section = self.get_or_create_suite_section( + test_suite, test_case.suite_section_name + ) test_case_in_tms = self.search_test_case_id(test_case.id) - steps = [ - {"content": value, "expected": " "} - for key, value in test_case.steps.items() - ] + steps = [{"content": value, "expected": " "} for key, value in test_case.steps.items()] if test_case: self.update_test_case(test_case, test_case_in_tms) else: - self.create_test_case(test_case) \ No newline at end of file + self.create_test_case(test_case) diff --git a/src/frostfs_testlib/analytics/testrail_exporter.py b/src/frostfs_testlib/analytics/testrail_exporter.py index cefbf2e7..1a7c8504 100644 --- a/src/frostfs_testlib/analytics/testrail_exporter.py +++ b/src/frostfs_testlib/analytics/testrail_exporter.py @@ -1,22 +1,22 @@ from testrail_api import TestRailAPI -from test_collector import TestCase -from test_exporter import TestExporter +from frostfs_testlib.analytics.test_collector import TestCase +from frostfs_testlib.analytics.test_exporter import TestExporter class TestrailExporter(TestExporter): def __init__( - self, - tr_url: str, - tr_username: str, - tr_password: str, - tr_project_id: int, - tr_template_id_without_steps: int, - tr_template_id_with_steps: int, - tr_priority_map: dict, - tr_id_field: str, - tr_description_fields: str, - tr_steps_field: str, + self, + tr_url: str, + tr_username: str, + tr_password: str, + tr_project_id: int, + tr_template_id_without_steps: int, + tr_template_id_with_steps: int, + tr_priority_map: dict, + tr_id_field: str, + tr_description_fields: str, + tr_steps_field: str, ): """ Redefine init for base exporter for get test rail credentials and project on create exporter @@ -101,7 +101,9 @@ class TestrailExporter(TestExporter): elif len(test_rail_suites) == 1: return test_rail_suites.pop() else: - raise RuntimeError(f"Too many results found in test rail for suite name {test_suite_name}") + raise RuntimeError( + f"Too many results found in test rail for suite name {test_suite_name}" + ) def get_or_create_suite_section(self, test_rail_suite, section_name) -> object: """ @@ -137,19 +139,15 @@ class TestrailExporter(TestExporter): "title": test_case.title, "section_id": test_suite_section["id"], self.test_case_id_field_name: test_case.id, - } if test_case.priority: request_body["priority_id"] = self.tr_priority_map.get(test_case.priority) if test_case.steps: - steps = [ - {"content": value, "expected": " "} - for key, value in test_case.steps.items() - ] + steps = [{"content": value, "expected": " "} for key, value in test_case.steps.items()] request_body[self.tr_steps_field] = steps - request_body["template_id"]=self.tr_template_id_with_steps + request_body["template_id"] = self.tr_template_id_with_steps else: request_body["template_id"] = self.tr_template_id_without_steps if test_case.description: @@ -157,7 +155,6 @@ class TestrailExporter(TestExporter): return request_body - def create_test_case(self, test_case: TestCase, test_suite, test_suite_section) -> None: """ Create test case in Testrail @@ -166,13 +163,12 @@ class TestrailExporter(TestExporter): self.api.cases.add_case(**request_body) - - def update_test_case(self, test_case: TestCase, test_case_in_tms, test_suite, test_suite_section) -> None: + def update_test_case( + self, test_case: TestCase, test_case_in_tms, test_suite, test_suite_section + ) -> None: """ Update test case in Testrail """ request_body = self.prepare_request_body(test_case, test_suite, test_suite_section) self.api.cases.update_case(case_id=test_case_in_tms["id"], **request_body) - - diff --git a/src/frostfs_testlib/blockchain/role_designation.py b/src/frostfs_testlib/blockchain/role_designation.py index 14d321bd..4535300c 100644 --- a/src/frostfs_testlib/blockchain/role_designation.py +++ b/src/frostfs_testlib/blockchain/role_designation.py @@ -2,11 +2,10 @@ import json from time import sleep from typing import Optional -from cli import NeoGo -from shell import Shell -from utils.converters import process_b64_bytearray - from frostfs_testlib.blockchain import Multisig +from frostfs_testlib.cli import NeoGo +from frostfs_testlib.shell import Shell +from frostfs_testlib.utils.converting_utils import process_b64_bytearray class RoleDesignation: diff --git a/src/frostfs_testlib/resources/__init__.py b/src/frostfs_testlib/resources/__init__.py index 641b47e6..71bb0534 100644 --- a/src/frostfs_testlib/resources/__init__.py +++ b/src/frostfs_testlib/resources/__init__.py @@ -1 +1 @@ -import common +from frostfs_testlib.resources import common diff --git a/tests/test_converters.py b/tests/test_converters.py index 77be4253..8ff923da 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -7,40 +7,40 @@ class TestConverters(TestCase): def test_str_to_ascii_hex(self): source_str = "" result_str = "" - self.assertEqual(converters.str_to_ascii_hex(source_str), result_str) + self.assertEqual(converting_utils.str_to_ascii_hex(source_str), result_str) source_str = '"test_data" f0r ^convert*' result_str = "22746573745f646174612220663072205e636f6e766572742a" - self.assertEqual(converters.str_to_ascii_hex(source_str), result_str) + self.assertEqual(converting_utils.str_to_ascii_hex(source_str), result_str) def test_ascii_hex_to_str(self): source_str = "" result_bytes = b"" - self.assertEqual(converters.ascii_hex_to_str(source_str), result_bytes) + self.assertEqual(converting_utils.ascii_hex_to_str(source_str), result_bytes) source_str = "22746573745f646174612220663072205e636f6e766572742a" result_bytes = b'"test_data" f0r ^convert*' - self.assertEqual(converters.ascii_hex_to_str(source_str), result_bytes) + self.assertEqual(converting_utils.ascii_hex_to_str(source_str), result_bytes) def test_process_b64_bytearray_reverse(self): source_str = "" result_bytes = b"" - self.assertEqual(converters.process_b64_bytearray_reverse(source_str), result_bytes) + self.assertEqual(converting_utils.process_b64_bytearray_reverse(source_str), result_bytes) source_str = "InRlc3RfZGF0YSIgZjByIF5jb252ZXJ0Kg==" result_bytes = b"2a747265766e6f635e207230662022617461645f7473657422" - self.assertEqual(converters.process_b64_bytearray_reverse(source_str), result_bytes) + self.assertEqual(converting_utils.process_b64_bytearray_reverse(source_str), result_bytes) def test_process_b64_bytearray(self): source_str = "" result_bytes = b"" - self.assertEqual(converters.process_b64_bytearray(source_str), result_bytes) + self.assertEqual(converting_utils.process_b64_bytearray(source_str), result_bytes) source_str = "InRlc3RfZGF0YSIgZjByIF5jb252ZXJ0Kg==" result_bytes = b"22746573745f646174612220663072205e636f6e766572742a" - self.assertEqual(converters.process_b64_bytearray(source_str), result_bytes) + self.assertEqual(converting_utils.process_b64_bytearray(source_str), result_bytes) def test_contract_hash_to_address(self): source_str = "d01a381aae45f1ed181db9d554cc5ccc69c69f4e" result_str = "NT5hJ5peVmvYdZCsFKUM5MTcEGw5TB4k89" - self.assertEqual(converters.contract_hash_to_address(source_str), result_str) + self.assertEqual(converting_utils.contract_hash_to_address(source_str), result_str) diff --git a/tests/test_local_shell.py b/tests/test_local_shell.py index 3d05e5ba..62619197 100644 --- a/tests/test_local_shell.py +++ b/tests/test_local_shell.py @@ -2,8 +2,7 @@ from unittest import TestCase from frostfs_testlib.shell.interfaces import CommandOptions, InteractiveInput from frostfs_testlib.shell.local_shell import LocalShell - -from tests.helpers import format_error_details, get_output_lines +from helpers import format_error_details, get_output_lines class TestLocalShellInteractive(TestCase): diff --git a/tests/test_ssh_shell.py b/tests/test_ssh_shell.py index 021014a0..4d1c0fd0 100644 --- a/tests/test_ssh_shell.py +++ b/tests/test_ssh_shell.py @@ -3,8 +3,7 @@ from unittest import SkipTest, TestCase from frostfs_testlib.shell.interfaces import CommandOptions, InteractiveInput from frostfs_testlib.shell.ssh_shell import SSHShell - -from tests.helpers import format_error_details, get_output_lines +from helpers import format_error_details, get_output_lines def init_shell() -> SSHShell: