import testinfra.utils.ansible_runner

def test_packages(host):
  for package_name in ['cryptsetup', 'util-linux']:
    package = host.package(package_name)
    assert package.is_installed

def test_mount_device_encrypted(host):
  mount = host.mount_point('/mnt/data_decrypted')
  assert mount.exists
  assert mount.device == '/dev/mapper/data_encrypted'
  assert mount.filesystem == 'ext4'

def test_write_file(host):
  cmd = host.run('sudo touch /mnt/data_decrypted/test.txt')
  assert cmd.succeeded