import os
import testinfra.utils.ansible_runner


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


def test_user_exist(host):
    assert host.user('serviceuser').exists
    # cmd = host.run('cat /etc/passwd')
    # assert cmd.stdout.find(u'') > -1

def test_net_services_work(host):
    sudoers = host.file('/etc/sudoers')
    assert sudoers.contains('serviceuser ALL=NOPASSWD:/bin/systemctl')
0e722690f22ba142ae88f9f85a05fd07aae73e7e
<mask token>


def test_user_exist(host):
    assert host.user('serviceuser').exists


<mask token>

<mask token>


def test_user_exist(host):
    assert host.user('serviceuser').exists


def test_net_services_work(host):
    sudoers = host.file('/etc/sudoers')
    assert sudoers.contains('serviceuser ALL=NOPASSWD:/bin/systemctl')

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


def test_user_exist(host):
    assert host.user('serviceuser').exists


def test_net_services_work(host):
    sudoers = host.file('/etc/sudoers')
    assert sudoers.contains('serviceuser ALL=NOPASSWD:/bin/systemctl')

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


def test_user_exist(host):
    assert host.user('serviceuser').exists


def test_net_services_work(host):
    sudoers = host.file('/etc/sudoers')
    assert sudoers.contains('serviceuser ALL=NOPASSWD:/bin/systemctl')

import os
import testinfra.utils.ansible_runner


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


def test_user_exist(host):
    assert host.user('serviceuser').exists
    # cmd = host.run('cat /etc/passwd')
    # assert cmd.stdout.find(u'') > -1

def test_net_services_work(host):
    sudoers = host.file('/etc/sudoers')
    assert sudoers.contains('serviceuser ALL=NOPASSWD:/bin/systemctl')