Skip to content

Commit

Permalink
refactor test_uninstall.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 24, 2024
1 parent aeb2429 commit 8031648
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions test/env_commands/test_uninstall.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
from apio.commands.uninstall import cli as cmd_uninstall
"""
Test for the "apio uninstall" command
"""

# -- apio uninstall entry point
from apio.commands.uninstall import cli as cmd_uninstall

def test_uninstall(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_uninstall)
validate_cliresult(result)

def test_uninstall(clirunner, configenv, validate_cliresult):
"""Test "apio uninstall" with different parameters"""

def test_uninstall_list(clirunner, validate_cliresult, configenv):
with clirunner.isolated_filesystem():

# -- Config the environment (conftest.configenv())
configenv()
result = clirunner.invoke(cmd_uninstall, ['--list'])

# -- Execute "apio uninstall"
result = clirunner.invoke(cmd_uninstall)
validate_cliresult(result)

# -- Execute "apio uninstall --list"
result = clirunner.invoke(cmd_uninstall, ['--list'])
validate_cliresult(result)

def test_uninstall_wrong_package(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio uninstall missing_packge"
result = clirunner.invoke(
cmd_uninstall, ['missing_package'], input='y')
assert result.exit_code == 1
Expand Down

0 comments on commit 8031648

Please sign in to comment.