Merging upstream version 1.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
50f8dbf7e8
commit
2044ea6182
196 changed files with 10121 additions and 3780 deletions
|
@ -9,7 +9,6 @@ from typing import TYPE_CHECKING
|
|||
|
||||
from anta.cli import anta
|
||||
from anta.cli.utils import ExitCode
|
||||
from tests.lib.utils import default_anta_env
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from click.testing import CliRunner
|
||||
|
@ -49,10 +48,16 @@ def test_anta_nrfu_dry_run(click_runner: CliRunner) -> None:
|
|||
assert "Dry-run" in result.output
|
||||
|
||||
|
||||
def test_anta_nrfu_wrong_catalog_format(click_runner: CliRunner) -> None:
|
||||
"""Test anta nrfu --dry-run, catalog is given via env."""
|
||||
result = click_runner.invoke(anta, ["nrfu", "--dry-run", "--catalog-format", "toto"])
|
||||
assert result.exit_code == ExitCode.USAGE_ERROR
|
||||
assert "Invalid value for '--catalog-format': 'toto' is not one of 'yaml', 'json'." in result.output
|
||||
|
||||
|
||||
def test_anta_password_required(click_runner: CliRunner) -> None:
|
||||
"""Test that password is provided."""
|
||||
env = default_anta_env()
|
||||
env["ANTA_PASSWORD"] = None
|
||||
env = {"ANTA_PASSWORD": None}
|
||||
result = click_runner.invoke(anta, ["nrfu"], env=env)
|
||||
|
||||
assert result.exit_code == ExitCode.USAGE_ERROR
|
||||
|
@ -61,8 +66,7 @@ def test_anta_password_required(click_runner: CliRunner) -> None:
|
|||
|
||||
def test_anta_password(click_runner: CliRunner) -> None:
|
||||
"""Test that password can be provided either via --password or --prompt."""
|
||||
env = default_anta_env()
|
||||
env["ANTA_PASSWORD"] = None
|
||||
env = {"ANTA_PASSWORD": None}
|
||||
result = click_runner.invoke(anta, ["nrfu", "--password", "secret"], env=env)
|
||||
assert result.exit_code == ExitCode.OK
|
||||
result = click_runner.invoke(anta, ["nrfu", "--prompt"], input="password\npassword\n", env=env)
|
||||
|
@ -113,3 +117,9 @@ def test_disable_cache(click_runner: CliRunner) -> None:
|
|||
if "disable_cache" in line:
|
||||
assert "True" in line
|
||||
assert result.exit_code == ExitCode.OK
|
||||
|
||||
|
||||
def test_hide(click_runner: CliRunner) -> None:
|
||||
"""Test the `--hide` option of the `anta nrfu` command."""
|
||||
result = click_runner.invoke(anta, ["nrfu", "--hide", "success", "text"])
|
||||
assert "SUCCESS" not in result.output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue