|
@@ -1,5 +1,7 @@
|
|
|
import sys
|
|
|
|
|
|
+import pytest
|
|
|
+import ruamel.yaml
|
|
|
from flexmock import flexmock
|
|
|
|
|
|
from borgmatic.config import load as module
|
|
@@ -38,3 +40,23 @@ def test_load_configuration_merges_include():
|
|
|
)
|
|
|
|
|
|
assert module.load_configuration('config.yaml') == {'foo': 'override', 'baz': 'quux'}
|
|
|
+
|
|
|
+
|
|
|
+def test_load_configuration_does_not_merge_include_list():
|
|
|
+ builtins = flexmock(sys.modules['builtins'])
|
|
|
+ builtins.should_receive('open').with_args('include.yaml').and_return(
|
|
|
+ '''
|
|
|
+ - one
|
|
|
+ - two
|
|
|
+ '''
|
|
|
+ )
|
|
|
+ builtins.should_receive('open').with_args('config.yaml').and_return(
|
|
|
+ '''
|
|
|
+ foo: bar
|
|
|
+ repositories:
|
|
|
+ <<: !include include.yaml
|
|
|
+ '''
|
|
|
+ )
|
|
|
+
|
|
|
+ with pytest.raises(ruamel.yaml.error.YAMLError):
|
|
|
+ assert module.load_configuration('config.yaml')
|