27 lines
603 B
Python
27 lines
603 B
Python
import click.testing
|
|
import pytest
|
|
|
|
import spud.cli
|
|
|
|
|
|
@pytest.fixture(name="sample_config")
|
|
def sample_config_fixture():
|
|
return {"api_baseurl": "http://test.url"}
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def mock_default_config_path(monkeypatch, tmpdir):
|
|
monkeypatch.setattr(
|
|
spud.cli,
|
|
"DEFAULT_CONFIGURATION_PATH",
|
|
tmpdir / ".config" / "spud" / "config.json",
|
|
)
|
|
|
|
|
|
@pytest.fixture(name="invoke_cli")
|
|
def invoke_cli_fixture():
|
|
def _call_cli(args: list[str]):
|
|
runner = click.testing.CliRunner()
|
|
return runner.invoke(spud.cli.cli, args)
|
|
|
|
return _call_cli
|