示例#1
0
def test_connect_to_db():
    """ Try to open database """
    cfg = Config()
    db_path = cfg.get(ConfigKeys.asset_allocation_database_path)

    session = dal.get_session(db_path)
    print(session)
示例#2
0
def get(aadb: str):
    """ Retrieves a value from config """
    if (aadb):
        cfg = Config()
        value = cfg.get(ConfigKeys.asset_allocation_database_path)
        click.echo(value)

    if not aadb:
        click.echo("Use --help for more information.")
示例#3
0
def test_loading_records(config: Config):
    """ Load test data from db """
    db_path = config.get(ConfigKeys.asset_allocation_database_path)
    full_path = path.abspath(db_path)
    log(DEBUG, f"db: {db_path}, {full_path}")

    x: AssetAllocationLoader = AssetAllocationLoader(config=config)
    # log(DEBUG, f"using configuration: {x.config}")
    actual = x.load_tree_from_db()

    assert len(actual.classes) == 2