Skip to content

Commit

Permalink
refactor test_examples.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 24, 2024
1 parent 891c99c commit 7e268c4
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions test/env_commands/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
"""
Test for the "apio examples" command
"""

# -- apio examples entry point
from apio.commands.examples import cli as cmd_examples


def test_examples(clirunner, validate_cliresult, configenv):
result = clirunner.invoke(cmd_examples)
validate_cliresult(result)

"""Test "apio examples" with different parameters"""

def test_examples_list(clirunner, configenv):
with clirunner.isolated_filesystem():

# -- Config the environment (conftest.configenv())
configenv()

# -- Execute "apio examples"
result = clirunner.invoke(cmd_examples)
validate_cliresult(result)

# -- Execute "apio examples --list"
result = clirunner.invoke(cmd_examples, ['--list'])
assert result.exit_code == 1
assert 'apio install examples' in result.output


def test_examples_dir(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio examples --dir dir"
result = clirunner.invoke(cmd_examples, ['--dir', 'dir'])
assert result.exit_code == 1
assert 'apio install examples' in result.output


def test_examples_files(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio examples --files file"
result = clirunner.invoke(cmd_examples, ['--files', 'file'])
assert result.exit_code == 1
assert 'apio install examples' in result.output

0 comments on commit 7e268c4

Please sign in to comment.