Skip to content

Commit

Permalink
test: Add basic unit tests for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
titom73 committed Dec 11, 2024
1 parent 4c1b05d commit 1cd1a64
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest
from click.testing import CliRunner
from eos_downloader.cli.cli import ardl

@pytest.fixture
def runner():
return CliRunner()

def test_ardl_help(runner):
result = runner.invoke(ardl, ['--help'])
assert result.exit_code == 0
assert "Arista Network Download CLI" in result.output

def test_ardl_version(runner):
result = runner.invoke(ardl, ['--version'])
assert result.exit_code == 0
assert "version" in result.output

def test_cli_execution(runner):
result = runner.invoke(ardl, [])
assert result.exit_code == 0
assert "Usage: ardl [OPTIONS] COMMAND [ARGS]..." in result.output
assert "Arista Network Download CLI" in result.output

13 changes: 13 additions & 0 deletions tests/unit/cli/test_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import pytest
from click.testing import CliRunner
from eos_downloader.cli.cli import ardl

@pytest.fixture
def runner():
return CliRunner()

def test_debug_help(runner):
result = runner.invoke(ardl, ['debug', '--help'])
assert result.exit_code == 0
assert "Debug commands to work with ardl" in result.output
13 changes: 13 additions & 0 deletions tests/unit/cli/test_get.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import pytest
from click.testing import CliRunner
from eos_downloader.cli.cli import ardl

@pytest.fixture
def runner():
return CliRunner()

def test_get_help(runner):
result = runner.invoke(ardl, ['get', '--help'])
assert result.exit_code == 0
assert "Download Arista from Arista website" in result.output
13 changes: 13 additions & 0 deletions tests/unit/cli/test_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import pytest
from click.testing import CliRunner
from eos_downloader.cli.cli import ardl

@pytest.fixture
def runner():
return CliRunner()

def test_info_help(runner):
result = runner.invoke(ardl, ['info', '--help'])
assert result.exit_code == 0
assert "List information from Arista website" in result.output

0 comments on commit 1cd1a64

Please sign in to comment.