bc2d2917c3
This fixture itself uses the 'use_old_replica_state' fixture, so that it's no longer needed to use it explicitly in test functions.
24 lines
607 B
Python
24 lines
607 B
Python
from click.testing import CliRunner
|
|
|
|
from check_patroni.cli import main
|
|
|
|
|
|
def test_api_status_code_200(fake_restapi) -> None:
|
|
runner = CliRunner()
|
|
|
|
fake_restapi("node_is_pending_restart_ok")
|
|
result = runner.invoke(
|
|
main, ["-e", "https://10.20.199.3:8008", "node_is_pending_restart"]
|
|
)
|
|
assert result.exit_code == 0
|
|
|
|
|
|
def test_api_status_code_404(fake_restapi) -> None:
|
|
runner = CliRunner()
|
|
|
|
fake_restapi("Fake test", status=404)
|
|
result = runner.invoke(
|
|
main, ["-e", "https://10.20.199.3:8008", "node_is_pending_restart"]
|
|
)
|
|
assert result.exit_code == 3
|