def test_several_calls():
    """Check that everybody will obtain the same class.

    1. Get declarative base twice.
    2. Check that obtained objects are the same.
    """
    first_base_class = base.get_base()
    second_base_class = base.get_base()
    assert first_base_class is second_base_class, "Base class objects are not the same"
def test_base_type():
    """Check the type of the declarative base class.

    1. Get declarative base.
    2. Check instance of the declarative base.
    """
    base_class = base.get_base()
    assert isinstance(base_class, api.DeclarativeMeta), (
        "Base class is not an instance of DeclarativeMeta"
        )
示例#3
0
def prepare_metadata():
    """Prepare base with metadata.

    :return: prepared metadata.
    """
    base = get_base()

    from autostorage.database.model.scenario.scenario import Scenario
    from autostorage.database.model.scenario.view_state import ScenarioViewState
    from autostorage.database.model.scenario.structure_state import (
        ScenarioStructureState, ScenarioStructureChange, ScenarioStructureLock
        )
    from autostorage.database.model.scenario.parse_state import ScenarioParseState
    from autostorage.database.model.scenario.node import ScenarioNode
    from autostorage.database.model.scenario.node_state import ScenarioNodeState
    from autostorage.database.model.report.result import Result
    from autostorage.database.model.report.file import ReportFile
    from autostorage.database.model.report.node import ReportNode
    from autostorage.database.model.parse.rule import ParseRule
    from autostorage.database.model.parse.rule_state import ParseRuleState

    return base.metadata