Blame tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh

3b3229
#!/bin/bash
3b3229
3b3229
t_Log "Running $0 - Apache httpd python38-mod_wsgi is functional"
3b3229
f49232
f49232
if (t_GetPkgRel basesystem | grep -q el9)
f49232
then
f49232
  t_Log "This is a C9 system. python3-mod_wsgi not present. Skipping."
f49232
  t_CheckExitStatus 0
f49232
  exit $PASS
f49232
fi
f49232
f49232
3b3229
if [[ $centos_ver -lt 8 ]]; then
3b3229
    t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP"
3b3229
    exit 0
3b3229
fi
3b3229
ed8a63
# TODO: remove after 8.2 rebuild
ed8a63
if [[ $centos_stream == "no" ]]; then
ed8a63
    t_Log "python38-mod_wsgi is only in CentOS Stream -> SKIP"
ed8a63
    exit 0
ed8a63
fi
ed8a63
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