2020-01-25 23:09:27 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
|
|
|
|
import warnings
|
2021-06-07 20:14:32 +00:00
|
|
|
|
2020-01-25 23:09:27 +00:00
|
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
|
|
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
2021-06-07 20:14:32 +00:00
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']
|
|
|
|
).get_hosts('all')
|
2020-01-25 23:09:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_smb_in_fstab(host):
|
|
|
|
fstab = host.file("/etc/fstab")
|
|
|
|
assert fstab.contains("//share.example.com/media")
|
|
|
|
|
|
|
|
|
|
|
|
def test_smb_credentials(host):
|
|
|
|
credentials = host.file("/root/.smbcredentials/multimedia")
|
|
|
|
assert credentials.exists
|
|
|
|
assert credentials.contains("username=myuser")
|
|
|
|
assert credentials.contains("password=secure")
|