Files @ 8f3635c67934
Branch filter:

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

branko
MAR-129: Minor preparation for updating Ansible version:

- Ignore the pytest_cache directory in Git.
- Updated Ansible to latest 2.3.x version in requirements file.
- Make sure the SSH client private keys have correct permissions when
testing the backup_server role (must be 0600), otherwise we get
errors from SSH due to insecure permissions during testing.
- Updated test for testing installed packages in the wsgi_website
Python virtual environment to test against up-to-date
packages. Might be nice to fix this one with something less hacky in
the long run.
import testinfra.utils.ansible_runner


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


def test_hosts_file(host):
    f = host.file('/etc/hosts')

    assert f.exists
    assert f.user == 'root'
    assert f.group == 'root'