File: test_007_ssi.py

package info (click to toggle)
apache2 2.4.66-5
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 59,500 kB
  • sloc: ansic: 212,331; python: 13,830; perl: 11,307; sh: 7,258; php: 1,320; javascript: 1,314; awk: 749; makefile: 715; lex: 374; yacc: 161; xml: 2
file content (42 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pytest

from .env import H2Conf, H2TestEnv


@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here")
class TestSSI:

    @pytest.fixture(autouse=True, scope='class')
    def _class_scope(self, env):
        conf = H2Conf(env, extras={
            f'cgi.{env.http_tld}': [
                'AddOutputFilter INCLUDES .html',
                '<Location "/ssi">',
                '  Options +Includes',
                '</Location>',
            ],
        })
        conf.add_vhost_cgi(
            proxy_self=True, h2proxy_self=True
        ).add_vhost_test1(
            proxy_self=True, h2proxy_self=True
        ).install()
        assert env.apache_restart() == 0

    # SSI test from https://bz.apache.org/bugzilla/show_bug.cgi?id=66483
    def test_h2_007_01(self, env):
        url = env.mkurl("https", "cgi", "/ssi/test.html")
        r = env.curl_get(url, 5)
        assert r.response["status"] == 200
        assert r.stdout == '''<!doctype html>
<html>
<head><meta charset="UTF-8"></head>
<body>
    test<br>
    Hello include<br>

    hello<br>
</body>
</html>
''' , f'{r}'