Files @ b1b2928c582b
Branch filter:

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

branko
Noticket: Fixed two tests related to application user profile directory in php_website role, and renamed two tests to make more sense.
import testinfra.utils.ansible_runner


testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    '.molecule/ansible_inventory').get_hosts('all')


def test_backup_patterns_file(File, Sudo):
    """
    Tests if deployed file with backup patterns has correct permissions.
    """

    with Sudo():

        backup_pattern = 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(File, Sudo):
    """
    Tests if assembled include file has correct permissions.
    """

    with Sudo():

        include = File('/etc/duply/main/include')

        assert include.is_file
        assert include.user == 'root'
        assert include.group == 'root'
        assert include.mode == 0o600