Deprecate validate-borgmatic-config in favor of new "config validate" action (#529).
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-06-23 10:11:41 -07:00
parent 23809e9060
commit e4e455ee45
16 changed files with 266 additions and 111 deletions

View File

View File

@@ -0,0 +1,37 @@
import argparse
from flexmock import flexmock
import borgmatic.logger
from borgmatic.actions.config import validate as module
def test_run_validate_with_show_renders_configurations():
log_lines = []
borgmatic.logger.add_custom_log_levels()
def fake_logger_answer(message):
log_lines.append(message)
flexmock(module.logger).should_receive('answer').replace_with(fake_logger_answer)
module.run_validate(argparse.Namespace(show=True), {'test.yaml': {'foo': {'bar': 'baz'}}})
assert log_lines == ['''foo:\n bar: baz\n''']
def test_run_validate_with_show_and_multiple_configs_renders_each():
log_lines = []
borgmatic.logger.add_custom_log_levels()
def fake_logger_answer(message):
log_lines.append(message)
flexmock(module.logger).should_receive('answer').replace_with(fake_logger_answer)
module.run_validate(
argparse.Namespace(show=True),
{'test.yaml': {'foo': {'bar': 'baz'}}, 'other.yaml': {'quux': 'value'}},
)
assert log_lines == ['---', 'foo:\n bar: baz\n', '---', 'quux: value\n']