Files @ b55cb83f8342
Branch filter:

Location: majic-ansible-roles/roles/backup/molecule/default/tests/test_default.py

branko
Noticket: Added workaround to development process for outdated Molecule version:

- Unfortunately, the Molecule version used for running tests does not
generate valid Ruby 3.x code. For now just work around the way Hash
is unpacked in function calls to optional arguments (until the test
stack gets a revamp).
import os

import testinfra.utils.ansible_runner


testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-*')


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