Merging upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
082ce481df
commit
2265bd9c67
211 changed files with 12174 additions and 6401 deletions
|
@ -1,9 +1,7 @@
|
|||
# Copyright (c) 2023-2024 Arista Networks, Inc.
|
||||
# Use of this source code is governed by the Apache License 2.0
|
||||
# that can be found in the LICENSE file.
|
||||
"""
|
||||
Tests for anta.cli.exec.commands
|
||||
"""
|
||||
"""Tests for anta.cli.exec.commands."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
@ -21,27 +19,21 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
def test_clear_counters_help(click_runner: CliRunner) -> None:
|
||||
"""
|
||||
Test `anta exec clear-counters --help`
|
||||
"""
|
||||
"""Test `anta exec clear-counters --help`."""
|
||||
result = click_runner.invoke(clear_counters, ["--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "Usage" in result.output
|
||||
|
||||
|
||||
def test_snapshot_help(click_runner: CliRunner) -> None:
|
||||
"""
|
||||
Test `anta exec snapshot --help`
|
||||
"""
|
||||
"""Test `anta exec snapshot --help`."""
|
||||
result = click_runner.invoke(snapshot, ["--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "Usage" in result.output
|
||||
|
||||
|
||||
def test_collect_tech_support_help(click_runner: CliRunner) -> None:
|
||||
"""
|
||||
Test `anta exec collect-tech-support --help`
|
||||
"""
|
||||
"""Test `anta exec collect-tech-support --help`."""
|
||||
result = click_runner.invoke(collect_tech_support, ["--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "Usage" in result.output
|
||||
|
@ -55,9 +47,7 @@ def test_collect_tech_support_help(click_runner: CliRunner) -> None:
|
|||
],
|
||||
)
|
||||
def test_clear_counters(click_runner: CliRunner, tags: str | None) -> None:
|
||||
"""
|
||||
Test `anta exec clear-counters`
|
||||
"""
|
||||
"""Test `anta exec clear-counters`."""
|
||||
cli_args = ["exec", "clear-counters"]
|
||||
if tags is not None:
|
||||
cli_args.extend(["--tags", tags])
|
||||
|
@ -69,7 +59,7 @@ COMMAND_LIST_PATH_FILE = Path(__file__).parent.parent.parent.parent / "data" / "
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"commands_path, tags",
|
||||
("commands_path", "tags"),
|
||||
[
|
||||
pytest.param(None, None, id="missing command list"),
|
||||
pytest.param(Path("/I/do/not/exist"), None, id="wrong path for command_list"),
|
||||
|
@ -78,9 +68,7 @@ COMMAND_LIST_PATH_FILE = Path(__file__).parent.parent.parent.parent / "data" / "
|
|||
],
|
||||
)
|
||||
def test_snapshot(tmp_path: Path, click_runner: CliRunner, commands_path: Path | None, tags: str | None) -> None:
|
||||
"""
|
||||
Test `anta exec snapshot`
|
||||
"""
|
||||
"""Test `anta exec snapshot`."""
|
||||
cli_args = ["exec", "snapshot", "--output", str(tmp_path)]
|
||||
# Need to mock datetetime
|
||||
if commands_path is not None:
|
||||
|
@ -99,7 +87,7 @@ def test_snapshot(tmp_path: Path, click_runner: CliRunner, commands_path: Path |
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"output, latest, configure, tags",
|
||||
("output", "latest", "configure", "tags"),
|
||||
[
|
||||
pytest.param(None, None, False, None, id="no params"),
|
||||
pytest.param("/tmp/dummy", None, False, None, id="with output"),
|
||||
|
@ -109,9 +97,7 @@ def test_snapshot(tmp_path: Path, click_runner: CliRunner, commands_path: Path |
|
|||
],
|
||||
)
|
||||
def test_collect_tech_support(click_runner: CliRunner, output: str | None, latest: str | None, configure: bool | None, tags: str | None) -> None:
|
||||
"""
|
||||
Test `anta exec collect-tech-support`
|
||||
"""
|
||||
"""Test `anta exec collect-tech-support`."""
|
||||
cli_args = ["exec", "collect-tech-support"]
|
||||
if output is not None:
|
||||
cli_args.extend(["--output", output])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue