diff --git a/roles/web_server/molecule/default/tests/test_default.py b/roles/web_server/molecule/default/tests/test_default.py index a88322260c31ff8efab6cf61edd060a30f89b687..a5c3a1815560821c28915c3ab2e87aaa41b7acdd 100644 --- a/roles/web_server/molecule/default/tests/test_default.py +++ b/roles/web_server/molecule/default/tests/test_default.py @@ -300,3 +300,31 @@ def test_nginx_tls_files(host): assert tls_file.group == 'root' assert tls_file.mode == 0o644 assert tls_file.content_string == open("tests/data/x509/server/%s_https.cert.pem" % hostname, "r").read().rstrip() + + +def test_certificate_validity_check_configuration(host): + """ + Tests if certificate validity check configuration file has been deployed + correctly. + """ + + hostname = host.run('hostname').stdout.strip() + + config = host.file('/etc/check_certificate/%s_https.conf' % hostname) + assert config.is_file + assert config.user == 'root' + assert config.group == 'root' + assert config.mode == 0o644 + assert config.content_string == "/etc/ssl/certs/%s_https.pem" % hostname + + +def test_tls_enabled(host): + """ + Tests if TLS has been enabled. + """ + + hostname = host.run('hostname').stdout.strip() + fqdn = hostname[:hostname.rfind('-')] + + tls = host.run('wget -q -O - https://%s/', fqdn) + assert tls.rc == 0