<commit_before>import os

import testinfra.utils.ansible_runner

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


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

    assert f.exists
    assert f.user == 'root'
    assert f.group == 'root'<commit_msg>Fix testinfra deprecation warnings<commit_after>import os

import testinfra.utils.ansible_runner

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


def test_nginx_config_file(host):
    f = host.file('/etc/nginx/nginx.conf')

    assert f.exists
    assert f.user == 'root'
    assert f.group == 'root'
    assert f.mode == 0o644


def test_nginx_service(host):
    s = host.service('nginx')

    assert s.is_enabled
    assert s.is_running


def test_sshd_process(host):
    p = host.process.filter(user='root', comm='nginx')

    assert len(p) >= 1


# FIX: Port to be tested should be retrieved from Ansible variables
def test_sshd_socket(host):
    s = host.socket("tcp://0.0.0.0:80")

    assert s.is_listening
{'fraction_non_alphanumeric': 0.12389380530973451, 'fraction_numerical': 0.009734513274336283, 'mean_word_length': 4.094594594594595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7376427', 'n_tokens_mistral': 429, 'n_tokens_neox': 393, 'n_words': 76}