2023-09-28 10:57:24 +02:00
|
|
|
from functools import partial
|
|
|
|
from typing import Any, Callable
|
|
|
|
|
|
|
|
import pytest
|
2023-09-28 09:41:33 +02:00
|
|
|
from click.testing import CliRunner
|
2023-09-28 10:57:24 +02:00
|
|
|
from pytest_mock import MockerFixture
|
|
|
|
|
|
|
|
from .tools import my_mock
|
2023-09-28 09:37:44 +02:00
|
|
|
|
|
|
|
|
2023-10-03 14:29:21 +02:00
|
|
|
@pytest.fixture(
|
|
|
|
params=[False, True],
|
|
|
|
ids=lambda v: "new-replica-state" if v else "old-replica-state",
|
|
|
|
)
|
|
|
|
def old_replica_state(request: Any) -> Any:
|
|
|
|
return request.param
|
2023-09-28 10:57:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2023-10-03 14:29:21 +02:00
|
|
|
def fake_restapi(mocker: MockerFixture) -> Callable[..., Any]:
|
|
|
|
return partial(my_mock, mocker)
|
2023-09-28 09:41:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def runner() -> CliRunner:
|
|
|
|
"""A CliRunner with stdout and stderr not mixed."""
|
|
|
|
return CliRunner(mix_stderr=False)
|