2019-09-18 13:28:46 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
|
2019-10-15 21:23:56 +00:00
|
|
|
import warnings
|
|
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
|
|
2019-09-18 13:28:46 +00:00
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
|
|
|
|
|
|
|
2019-10-15 21:23:56 +00:00
|
|
|
def test_certbot_is_installed(host):
|
2020-04-20 21:31:55 +00:00
|
|
|
pkg = host.pip_package.get_packages(pip_path="pip3")
|
|
|
|
assert "certbot" in pkg
|
|
|
|
|
|
|
|
|
|
|
|
def test_certbot_run(host):
|
2020-04-20 21:45:34 +00:00
|
|
|
cmd = host.run("~/.local/bin/certbot --help")
|
2020-04-20 21:31:55 +00:00
|
|
|
assert "Certbot can obtain and install HTTPS/TLS/SSL certificates." in cmd.stdout
|
|
|
|
assert cmd.succeeded
|