xref: /unit/test/test_routing_tls.py (revision 1596:b7e2d4d92624)
1from unit.applications.tls import TestApplicationTLS
2
3
4class TestRoutingTLS(TestApplicationTLS):
5    prerequisites = {'modules': {'openssl': 'any'}}
6
7    def test_routes_match_scheme_tls(self):
8        self.certificate()
9
10        assert 'success' in self.conf(
11            {
12                "listeners": {
13                    "*:7080": {"pass": "routes"},
14                    "*:7081": {
15                        "pass": "routes",
16                        "tls": {"certificate": 'default'},
17                    },
18                },
19                "routes": [
20                    {"match": {"scheme": "http"}, "action": {"return": 200}},
21                    {"match": {"scheme": "https"}, "action": {"return": 201}},
22                ],
23                "applications": {},
24            }
25        ), 'scheme configure'
26
27        assert self.get()['status'] == 200, 'http'
28        assert self.get_ssl(port=7081)['status'] == 201, 'https'
29