Files
@ b68d19ad38a3
Branch filter:
Location: majic-ansible-roles/roles/xmpp_server/tests/test_optional.py - annotation
b68d19ad38a3
2.7 KiB
text/x-python
MAR-33: Added initial scaffolding for wsgi_website tests:
- Added Molecule configuration file.
- Implemented test playbook that sets-up three separate instances of WSGI
website in order to test all variations of parameters.
- Added name for the set_fact task.
- Fixed linting errors related to mode that lacks leading zero.
- Added skip_ansible_lint tag for command that creates the Python virtual
environment.
- Added missing become keyword wherever become_user is specified.
- Fixed invalid parameter name for specifying if HTTPS should be enforced or
not.
- Added small initial sample WSGI apps that get deployed.
- Added static/media sample files.
- Added TLS material.
- Added initial dummy test file.
- Added Molecule configuration file.
- Implemented test playbook that sets-up three separate instances of WSGI
website in order to test all variations of parameters.
- Added name for the set_fact task.
- Fixed linting errors related to mode that lacks leading zero.
- Added skip_ansible_lint tag for command that creates the Python virtual
environment.
- Added missing become keyword wherever become_user is specified.
- Fixed invalid parameter name for specifying if HTTPS should be enforced or
not.
- Added small initial sample WSGI apps that get deployed.
- Added static/media sample files.
- Added TLS material.
- Added initial dummy test file.
da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 da031f975c67 | import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('parameters-optional')
def test_prosody_tls_files(File, Sudo):
"""
Tests if Prosody TLS private key and certificage have been deployed
correctly.
"""
with Sudo():
tls_file = File('/etc/ssl/private/parameters-optional_xmpp.key')
assert tls_file.is_file
assert tls_file.user == 'root'
assert tls_file.group == 'prosody'
assert tls_file.mode == 0o640
assert tls_file.content == open("tests/data/x509/parameters-optional_xmpp.key.pem", "r").read().rstrip()
tls_file = File('/etc/ssl/certs/parameters-optional_xmpp.pem')
assert tls_file.is_file
assert tls_file.user == 'root'
assert tls_file.group == 'root'
assert tls_file.mode == 0o644
assert tls_file.content == open("tests/data/x509/parameters-optional_xmpp.cert.pem", "r").read().rstrip()
def test_certificate_validity_check_configuration(File):
"""
Tests if certificate validity check configuration file has been deployed
correctly.
"""
config = File('/etc/check_certificate/parameters-optional_xmpp.conf')
assert config.is_file
assert config.user == 'root'
assert config.group == 'root'
assert config.mode == 0o644
assert config.content == "/etc/ssl/certs/parameters-optional_xmpp.pem"
def test_prosody_configuration_file_content(File, Sudo):
"""
Tests if Prosody configuration file has correct content.
"""
with Sudo():
config = File('/etc/prosody/prosody.cfg.lua')
assert "admins = { \"jane.doe@domain2\", \"mick.doe@domain3\", }" in config.content
assert "key = \"/etc/ssl/private/parameters-optional_xmpp.key\";" in config.content
assert "certificate = \"/etc/ssl/certs/parameters-optional_xmpp.pem\";" in config.content
assert "ldap_server = \"ldap-server\"" in config.content
assert "ldap_rootdn = \"cn=prosody,ou=services,dc=local\"" in config.content
assert "ldap_password = \"prosodypassword\"" in config.content
assert "ldap_filter = \"(&(mail=$user@$host)(memberOf=cn=xmpp,ou=groups,dc=local))\"" in config.content
assert "ldap_base = \"ou=people,dc=local\"" in config.content
assert """VirtualHost "domain2"
Component "conference.domain2" "muc"
restrict_room_creation = "local"
Component "proxy.domain2" "proxy65"
proxy65_acl = { "domain2" }""" in config.content
assert """VirtualHost "domain3"
Component "conference.domain3" "muc"
restrict_room_creation = "local"
Component "proxy.domain3" "proxy65"
proxy65_acl = { "domain3" }""" in config.content
|