import testinfra.utils.ansible_runner

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


def test_hosts_file(File):
    f = File('/etc/hosts')

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

import testinfra.utils.ansible_runner

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


def test_service_running_and_enabled(Service):
    collectd = Service("collectd")
    collectd.is_running
    collectd.is_enabled

Write a sensible (if post hoc) test.
Write a sensible (if post hoc) test.

I had a hard time getting this test to fail so I could prove it works, but
it's a simple test and its main purpose is to provide an example for
later tests, so I'm calling it Good Enough.

  import testinfra.utils.ansible_runner
  
  testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
      '.molecule/ansible_inventory').get_hosts('all')
  
  
- def test_hosts_file(File):
-     f = File('/etc/hosts')
+ def test_service_running_and_enabled(Service):
+     collectd = Service("collectd")
+     collectd.is_running
+     collectd.is_enabled
  
-     assert f.exists
-     assert f.user == 'root'
-     assert f.group == 'root'
- 
Write a sensible (if post hoc) test.
## Code Before:
import testinfra.utils.ansible_runner

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


def test_hosts_file(File):
    f = File('/etc/hosts')

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

## Instruction:
Write a sensible (if post hoc) test.
## Code After:
import testinfra.utils.ansible_runner

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


def test_service_running_and_enabled(Service):
    collectd = Service("collectd")
    collectd.is_running
    collectd.is_enabled
