Deprecate validate-borgmatic-config in favor of new "config validate" action (#529).
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/actions/__init__.py
Normal file
0
tests/integration/actions/__init__.py
Normal file
0
tests/integration/actions/config/__init__.py
Normal file
0
tests/integration/actions/config/__init__.py
Normal file
37
tests/integration/actions/config/test_validate.py
Normal file
37
tests/integration/actions/config/test_validate.py
Normal 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']
|
||||
Reference in New Issue
Block a user