|
@@ -32,6 +32,21 @@ def test_collect_config_filenames_collects_files_from_given_directories_and_igno
|
|
|
)
|
|
|
|
|
|
|
|
|
+def test_collect_config_filenames_collects_files_from_given_directories_and_ignores_non_yaml_filenames():
|
|
|
+ config_paths = ('/etc/borgmatic.d',)
|
|
|
+ mock_path = flexmock(module.os.path)
|
|
|
+ mock_path.should_receive('exists').and_return(True)
|
|
|
+ mock_path.should_receive('isdir').with_args('/etc/borgmatic.d').and_return(True)
|
|
|
+ mock_path.should_receive('isdir').with_args('/etc/borgmatic.d/foo.yaml').and_return(False)
|
|
|
+ mock_path.should_receive('isdir').with_args('/etc/borgmatic.d/bar.yaml~').and_return(False)
|
|
|
+ mock_path.should_receive('isdir').with_args('/etc/borgmatic.d/baz.txt').and_return(False)
|
|
|
+ flexmock(module.os).should_receive('listdir').and_return(['foo.yaml', 'bar.yaml~', 'baz.txt'])
|
|
|
+
|
|
|
+ config_filenames = tuple(module.collect_config_filenames(config_paths))
|
|
|
+
|
|
|
+ assert config_filenames == ('/etc/borgmatic.d/foo.yaml',)
|
|
|
+
|
|
|
+
|
|
|
def test_collect_config_filenames_skips_etc_borgmatic_config_dot_yaml_if_it_does_not_exist():
|
|
|
config_paths = ('config.yaml', '/etc/borgmatic/config.yaml')
|
|
|
mock_path = flexmock(module.os.path)
|