2023-06-15 19:55:31 +02:00
|
|
|
import borgmatic.commands.arguments
|
|
|
|
from borgmatic.commands.completion import actions as module
|
|
|
|
|
|
|
|
|
|
|
|
def test_available_actions_uses_only_subactions_for_action_with_subactions():
|
2023-06-24 23:10:47 +02:00
|
|
|
(
|
|
|
|
unused_global_parser,
|
|
|
|
action_parsers,
|
|
|
|
unused_combined_parser,
|
|
|
|
) = borgmatic.commands.arguments.make_parsers()
|
2023-06-15 19:55:31 +02:00
|
|
|
|
2023-06-24 23:10:47 +02:00
|
|
|
actions = module.available_actions(action_parsers, 'config')
|
2023-06-15 19:55:31 +02:00
|
|
|
|
|
|
|
assert 'bootstrap' in actions
|
|
|
|
assert 'list' not in actions
|
|
|
|
|
|
|
|
|
|
|
|
def test_available_actions_omits_subactions_for_action_without_subactions():
|
2023-06-24 23:10:47 +02:00
|
|
|
(
|
|
|
|
unused_global_parser,
|
|
|
|
action_parsers,
|
|
|
|
unused_combined_parser,
|
|
|
|
) = borgmatic.commands.arguments.make_parsers()
|
2023-06-15 19:55:31 +02:00
|
|
|
|
2023-06-24 23:10:47 +02:00
|
|
|
actions = module.available_actions(action_parsers, 'list')
|
2023-06-15 19:55:31 +02:00
|
|
|
|
|
|
|
assert 'bootstrap' not in actions
|
|
|
|
assert 'config' in actions
|