From 06a6444c867268f82cd42035a39d62bf10ce16c4 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 6 Apr 2025 21:25:06 -0700 Subject: [PATCH] Expand test that checks whether schema actions correspond to supported actions. --- tests/integration/config/test_schema.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/integration/config/test_schema.py b/tests/integration/config/test_schema.py index 7cea0906..c4ae2b9e 100644 --- a/tests/integration/config/test_schema.py +++ b/tests/integration/config/test_schema.py @@ -25,17 +25,23 @@ ACTIONS_MODULE_NAMES_TO_OMIT = { ACTIONS_MODULE_NAMES_TO_ADD = {'key', 'umount'} -def test_schema_skip_actions_correspond_to_supported_actions(): +def test_schema_actions_correspond_to_supported_actions(): ''' - Ensure that the allowed actions in the schema's "skip_actions" option don't drift from - borgmatic's actual supported actions. + Ensure that the allowed actions in the schema's various options don't drift from borgmatic's + actual supported actions. ''' schema = borgmatic.config.load.load_configuration(borgmatic.config.validate.schema_filename()) - schema_skip_actions = set(schema['properties']['skip_actions']['items']['enum']) supported_actions = { module.name.replace('_', '-') for module in pkgutil.iter_modules(borgmatic.actions.__path__) if module.name not in ACTIONS_MODULE_NAMES_TO_OMIT }.union(ACTIONS_MODULE_NAMES_TO_ADD) + properties = schema['properties'] + commands_one_of = properties['commands']['items']['oneOf'] - assert schema_skip_actions == supported_actions + for schema_actions in ( + set(properties['skip_actions']['items']['enum']), + set(commands_one_of[0]['properties']['when']['items']['enum']), + set(commands_one_of[1]['properties']['when']['items']['enum']), + ): + assert schema_actions == supported_actions