This repository has been archived on 2024-06-02. You can view files and clone it, but cannot push or open issues or pull requests.
spud-py/tests/conftest.py

28 lines
603 B
Python
Raw Normal View History

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