use repository["path"] instead of repository

This commit is contained in:
Divyansh Singh 2023-03-25 01:04:57 +05:30
commit e83ad9e1e4
36 changed files with 193 additions and 134 deletions

View file

@ -63,7 +63,10 @@ def test_parse_configuration_transforms_file_into_mapping():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home', '/etc'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home', '/etc'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 7, 'keep_hourly': 24, 'keep_minutely': 60},
'consistency': {'checks': [{'name': 'repository'}, {'name': 'archives'}]},
}
@ -89,7 +92,7 @@ def test_parse_configuration_passes_through_quoted_punctuation():
assert config == {
'location': {
'source_directories': [f'/home/{string.punctuation}'],
'repositories': ['test.borg'],
'repositories': [{'path': 'test.borg', 'label': ''}],
}
}
assert logs == []
@ -151,7 +154,10 @@ def test_parse_configuration_inlines_include():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 7, 'keep_hourly': 24},
}
assert logs == []
@ -185,7 +191,10 @@ def test_parse_configuration_merges_include():
config, logs = module.parse_configuration('/tmp/config.yaml', '/tmp/schema.yaml')
assert config == {
'location': {'source_directories': ['/home'], 'repositories': ['hostname.borg']},
'location': {
'source_directories': ['/home'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
},
'retention': {'keep_daily': 1, 'keep_hourly': 24},
}
assert logs == []
@ -247,7 +256,7 @@ def test_parse_configuration_applies_overrides():
assert config == {
'location': {
'source_directories': ['/home'],
'repositories': ['hostname.borg'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
'local_path': 'borg2',
}
}
@ -273,7 +282,7 @@ def test_parse_configuration_applies_normalization():
assert config == {
'location': {
'source_directories': ['/home'],
'repositories': ['hostname.borg'],
'repositories': [{'path': 'hostname.borg', 'label': ''}],
'exclude_if_present': ['.nobackup'],
}
}