def test_ecosystem_and_keys_dynamic_class2():
    seq_num = 1
    es_model = get_ecosystem_model(backend_features=sm.get_be_features(1))
    for es in es_model.query.with_session(sm.get(seq_num)).all():
        model = get_ecosystem_model(
            backend_features=sm.get_be_features(seq_num))
        es = model.query.with_session(sm.get(seq_num)).get_or_404(es.id)
        k_model = get_keys_model(backend_features=sm.get_be_features(seq_num))
def test_ecosystem_and_keys_class():
    seq_num = 1
    es_model = get_ecosystem_model(
        backend_features=sm.get_be_features(seq_num))
    keys_model = get_keys_model(backend_features=sm.get_be_features(seq_num))
    for es in es_model.query.with_session(sm.get(seq_num)).all():
        keys_model.set_ecosystem(es.id)
        assert keys_model.query.with_session(sm.get(seq_num)).count() \
            >= len(app.config.get('DB_ENGINE_DISCOVERY_MAP'))
def test_keys_class():
    seq_num = 1
    es_model = get_ecosystem_model(
        backend_features=sm.get_be_features(seq_num))
    keys_model = get_keys_model(backend_features=sm.get_be_features(seq_num))

    e_caught = False
    try:
        keys_model.check_ecosystem()
    except EcosystemIsNotSetError as e:
        e_caught = True
    assert e_caught

    assert keys_model.query.with_session(sm.get(seq_num)).count() \
            >= len(app.config.get('DB_ENGINE_DISCOVERY_MAP'))
Exemplo n.º 4
0
seq_nums = (1, )  # 2, 3)
involved_models = [MemberModel]
app = create_test_app()
update_aux_db_engine_discovery_map(app,
                                   force_update=True,
                                   aux_db_engine_name_prefix='test_aux_')

from genesis_block_explorer.models.db_engine.session import SessionManager
from genesis_block_explorer.models.genesis.explicit import (
    get_ecosystem_model,
    get_keys_model,
)

ALLOW_BACKEND_DISTRUCTIVE_TESTS = False
sm = SessionManager(app=app)
EsKeys = get_keys_model(backend_features=sm.get_be_features(1))
Ecosystem = get_ecosystem_model(backend_features=sm.get_be_features(1))


@with_setup(my_setup, my_teardown)
def test_es_keys_model_version():
    seq_num = 1
    col_names = [c.name for c in EsKeys.__table__.columns]


@with_setup(my_setup, my_teardown)
def test_es_keys_query():
    seq_num = 1
    assert EsKeys.query.with_session(sm.get(seq_num)).count() \
            >= len(app.config.get('DB_ENGINE_DISCOVERY_MAP'))