Exemple #1
0
def test_get_db(runner, temp_git_folder, temp_envadmin_folder):  # noqa: F811
    parser = config.get_config(temp_git_folder)
    database = db.get_db(parser.get("main", "repo_path"))

    database.insert({'name': 'John', 'age': 22})
    User = Query()
    result = database.search(User.name == 'John')
    assert result[0]['name'] == 'John'
Exemple #2
0
def cli(ctx: Context, config_path: Path, namespace: str) -> None:
    """Variation-related tasks."""
    ctx.config = config.get_config(config_path)
    ctx.database = db.get_db(Path(ctx.config.get("main", "repo_path")))
    ctx.namespace = namespace

    try:
        ctx.database_table = ctx.database.table(ctx.namespace)
    except Exception as excp:
        click.echo("Namespace could not be loaded!")
        raise click.ClickException("Error: %s" % excp)
Exemple #3
0
def test_config_parser(runner, temp_git_folder, temp_envadmin_folder):  # noqa: F811
    parser = config.get_config(Path(temp_git_folder))
    assert "envadmin_sandbox" in parser.get("main", "repo_path")
Exemple #4
0
def cli(ctx: Context, config_path: Path) -> None:
    """Namespace-related tasks."""
    ctx.config = config.get_config(config_path)
    ctx.database = db.get_db(Path(ctx.config.get("main", "repo_path")))
Exemple #5
0
def test_config_parser_exception(runner, temp_git_folder, temp_envadmin_folder):  # noqa: F811
    with pytest.raises(ClickException) as excinfo:
        config.get_config("/what/ever")

        assert "Cannot find .envadmin file" in str(excinfo.value)