diff --git a/roles/backup/molecule/default/tests/test_default.py b/roles/backup/molecule/default/tests/test_default.py new file mode 100644 index 0000000000000000000000000000000000000000..077de93d4e69ee8dbf9eee9b66c5f11af1dfad5c --- /dev/null +++ b/roles/backup/molecule/default/tests/test_default.py @@ -0,0 +1,35 @@ +import testinfra.utils.ansible_runner + + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + '.molecule/ansible_inventory.yml').get_hosts('all') + + +def test_backup_patterns_file(host): + """ + Tests if deployed file with backup patterns has correct permissions. + """ + + with host.sudo(): + + backup_pattern = host.file('/etc/duply/main/patterns/test') + + assert backup_pattern.is_file + assert backup_pattern.user == 'root' + assert backup_pattern.group == 'root' + assert backup_pattern.mode == 0o600 + + +def test_include_file(host): + """ + Tests if assembled include file has correct permissions. + """ + + with host.sudo(): + + include = host.file('/etc/duply/main/include') + + assert include.is_file + assert include.user == 'root' + assert include.group == 'root' + assert include.mode == 0o600