forked from TrueCloudLab/frostfs-testlib
Fixing issues in imports after movin tests to pip install -e for testlib
Signed-off-by: Aleksei Chetaev <alex.chetaev@gmail.com>
This commit is contained in:
parent
4fd9d69701
commit
71b35d45c3
8 changed files with 51 additions and 55 deletions
|
@ -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
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
self.create_test_case(test_case)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1 +1 @@
|
|||
import common
|
||||
from frostfs_testlib.resources import common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue