|
@@ -92,6 +92,21 @@ from borgmatic.config import normalize as module
|
|
|
{'location': {'repositories': [{'path': '/repo'}]}},
|
|
|
False,
|
|
|
),
|
|
|
+ (
|
|
|
+ {'location': {'repositories': [{'path': 'foo@bar:/repo', 'label': 'foo'}]}},
|
|
|
+ {'location': {'repositories': [{'path': 'ssh://foo@bar/repo', 'label': 'foo'}]}},
|
|
|
+ True,
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ {'location': {'repositories': [{'path': 'file:///repo', 'label': 'foo'}]}},
|
|
|
+ {'location': {'repositories': [{'path': '/repo', 'label': 'foo'}]}},
|
|
|
+ False,
|
|
|
+ ),
|
|
|
+ (
|
|
|
+ {'location': {'repositories': [{'path': '/repo', 'label': 'foo'}]}},
|
|
|
+ {'location': {'repositories': [{'path': '/repo', 'label': 'foo'}]}},
|
|
|
+ False,
|
|
|
+ ),
|
|
|
),
|
|
|
)
|
|
|
def test_normalize_applies_hard_coded_normalization_to_config(
|
|
@@ -105,3 +120,15 @@ def test_normalize_applies_hard_coded_normalization_to_config(
|
|
|
assert logs
|
|
|
else:
|
|
|
assert logs == []
|
|
|
+
|
|
|
+
|
|
|
+def test_normalize_raises_error_if_repository_data_is_not_consistent():
|
|
|
+ with pytest.raises(TypeError):
|
|
|
+ module.normalize(
|
|
|
+ 'test.yaml',
|
|
|
+ {
|
|
|
+ 'location': {
|
|
|
+ 'repositories': [{'path': 'foo@bar:/repo', 'label': 'foo'}, 'file:///repo']
|
|
|
+ }
|
|
|
+ },
|
|
|
+ )
|