Blame tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh

3b3229
#!/bin/bash
3b3229
3b3229
t_Log "Running $0 - Apache httpd python3-mod_wsgi is functional"
3b3229
3b3229
if [[ $centos_ver -lt 8 ]]; then
3b3229
    t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> SKIP"
3b3229
    exit 0
3b3229
fi
3b3229
3b3229
cat > /etc/httpd/conf.d/tfapp.conf << EOF
3b3229
WSGIScriptAlias /tfapp /var/www/html/tfapp.wsgi
3b3229
EOF
3b3229
3b3229
cat > /var/www/html/tfapp.wsgi << EOF
3b3229
def application(environ, start_response):
3b3229
    status = '200 OK'
3b3229
    output = 't_functional_mod_wsgi_test'.encode()
3b3229
    response_headers = [
3b3229
        ('Content-type', 'text/plain'),
3b3229
        ('Content-Length', str(len(output)))
3b3229
    ]
3b3229
    start_response(status, response_headers)
3b3229
    return [output]
3b3229
EOF
3b3229
3b3229
systemctl restart httpd
3b3229
3b3229
curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test'
3b3229
t_CheckExitStatus $?
3b3229
3b3229
systemctl stop httpd
3b3229
3b3229
rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi