Files
@ 814be5def61d
Branch filter:
Location: majic-ansible-roles/roles/wsgi_website/molecule/default/tests/test_parameters_paste_req.py - annotation
814be5def61d
2.1 KiB
text/x-python
MAR-189: Added support for Debian 11 Bullseye to xmpp_server role:
- Roll-out LDAP client configuration since Bullseye does not come with
a stock one at /etc/ldap/ldap.conf that sets the trust anchor
correctly for validating LDAP server certificates.
- Drop the backports pinning in case of Bullseye (for now let's try to
keep the Buster and Bullseye at same versions for simplicity).
- Drop installation of Python apt bindings (no longer used).
- Tests for Buster and Bullseye need to be split-up a bit due to some
differences around backports etc.
- Roll-out LDAP client configuration since Bullseye does not come with
a stock one at /etc/ldap/ldap.conf that sets the trust anchor
correctly for validating LDAP server certificates.
- Drop the backports pinning in case of Bullseye (for now let's try to
keep the Buster and Bullseye at same versions for simplicity).
- Drop installation of Python apt bindings (no longer used).
- Tests for Buster and Bullseye need to be split-up a bit due to some
differences around backports etc.
b5ed796b566a 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 d62b3adec462 998aab91d6b4 998aab91d6b4 a1e0221d24e7 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 a1e0221d24e7 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 c8d4251a6ea5 998aab91d6b4 998aab91d6b4 a1e0221d24e7 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 a1e0221d24e7 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 a1e0221d24e7 998aab91d6b4 998aab91d6b4 998aab91d6b4 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a 38c3569bdc6a | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_index_page(host):
"""
Tests if index page is served correctly. This covers:
- Basic WSGI application operation.
- Handling of environment variables.
- Handling of proxy headers.
"""
page = host.run('curl -H "Accept-Encoding: plain" https://parameters-paste-req/')
assert page.rc == 0
assert "This is the WSGI application at parameters-paste-req." in page.stdout
assert "Requested URL was: https://parameters-paste-req/" in page.stdout
assert "MY_ENV_VAR: None" in page.stdout
assert "Accept-Encoding: plain" in page.stdout
assert "Python version: 2." in page.stdout
def test_static_file_serving(host):
"""
Tests serving of static files.
"""
page = host.run('curl https://parameters-paste-req/static/static_file.txt')
assert page.rc == 0
assert "This is the WSGI application at parameters-paste-req." in page.stdout
assert "Requested URL was: https://parameters-paste-req/static/static_file.txt" in page.stdout
page = host.run('curl https://parameters-paste-req/media/media_file.txt')
assert page.rc == 0
assert "This is the WSGI application at parameters-paste-req." in page.stdout
assert "Requested URL was: https://parameters-paste-req/media/media_file.txt" in page.stdout
def test_website_application_user(host):
"""
Tests if website application user has been created correctly.
"""
app_user = "web-parameters-paste-req"
expected_group = "web-parameters-paste-req"
expected_home = "/var/www/parameters-paste-req"
user = host.user(app_user)
assert user.exists
assert user.uid < 1000
assert user.group == expected_group
assert user.groups == [expected_group]
assert user.shell == '/bin/sh'
assert user.home == expected_home
with host.sudo():
umask = host.run("su -l " + app_user + " -c 'bash -c umask'")
assert umask.stdout == '0007\n'
|