Fix Bash completion for sub-actions like "borgmatic config bootstrap" (#697 follow-on work).
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
0
tests/integration/commands/completion/__init__.py
Normal file
0
tests/integration/commands/completion/__init__.py
Normal file
20
tests/integration/commands/completion/test_actions.py
Normal file
20
tests/integration/commands/completion/test_actions.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import borgmatic.commands.arguments
|
||||
from borgmatic.commands.completion import actions as module
|
||||
|
||||
|
||||
def test_available_actions_uses_only_subactions_for_action_with_subactions():
|
||||
unused_top_level_parser, subparsers = borgmatic.commands.arguments.make_parsers()
|
||||
|
||||
actions = module.available_actions(subparsers, 'config')
|
||||
|
||||
assert 'bootstrap' in actions
|
||||
assert 'list' not in actions
|
||||
|
||||
|
||||
def test_available_actions_omits_subactions_for_action_without_subactions():
|
||||
unused_top_level_parser, subparsers = borgmatic.commands.arguments.make_parsers()
|
||||
|
||||
actions = module.available_actions(subparsers, 'list')
|
||||
|
||||
assert 'bootstrap' not in actions
|
||||
assert 'config' in actions
|
||||
5
tests/integration/commands/completion/test_bash.py
Normal file
5
tests/integration/commands/completion/test_bash.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from borgmatic.commands.completion import bash as module
|
||||
|
||||
|
||||
def test_bash_completion_does_not_raise():
|
||||
assert module.bash_completion()
|
||||
5
tests/integration/commands/completion/test_fish.py
Normal file
5
tests/integration/commands/completion/test_fish.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from borgmatic.commands.completion import fish as module
|
||||
|
||||
|
||||
def test_fish_completion_does_not_raise():
|
||||
assert module.fish_completion()
|
||||
@@ -1,9 +0,0 @@
|
||||
from borgmatic.commands import completion as module
|
||||
|
||||
|
||||
def test_bash_completion_does_not_raise():
|
||||
assert module.bash_completion()
|
||||
|
||||
|
||||
def test_fish_completion_does_not_raise():
|
||||
assert module.fish_completion()
|
||||
Reference in New Issue
Block a user