xref: /unit/test/test_routing_tls.py (revision 1596:b7e2d4d92624)
11110Saxel.duch@nginx.comfrom unit.applications.tls import TestApplicationTLS
21110Saxel.duch@nginx.com
31110Saxel.duch@nginx.com
41110Saxel.duch@nginx.comclass TestRoutingTLS(TestApplicationTLS):
51467Szelenkov@nginx.com    prerequisites = {'modules': {'openssl': 'any'}}
61110Saxel.duch@nginx.com
71434Szelenkov@nginx.com    def test_routes_match_scheme_tls(self):
81110Saxel.duch@nginx.com        self.certificate()
91110Saxel.duch@nginx.com
10*1596Szelenkov@nginx.com        assert 'success' in self.conf(
11*1596Szelenkov@nginx.com            {
12*1596Szelenkov@nginx.com                "listeners": {
13*1596Szelenkov@nginx.com                    "*:7080": {"pass": "routes"},
14*1596Szelenkov@nginx.com                    "*:7081": {
15*1596Szelenkov@nginx.com                        "pass": "routes",
16*1596Szelenkov@nginx.com                        "tls": {"certificate": 'default'},
171110Saxel.duch@nginx.com                    },
18*1596Szelenkov@nginx.com                },
19*1596Szelenkov@nginx.com                "routes": [
20*1596Szelenkov@nginx.com                    {"match": {"scheme": "http"}, "action": {"return": 200}},
21*1596Szelenkov@nginx.com                    {"match": {"scheme": "https"}, "action": {"return": 201}},
22*1596Szelenkov@nginx.com                ],
23*1596Szelenkov@nginx.com                "applications": {},
24*1596Szelenkov@nginx.com            }
25*1596Szelenkov@nginx.com        ), 'scheme configure'
261110Saxel.duch@nginx.com
27*1596Szelenkov@nginx.com        assert self.get()['status'] == 200, 'http'
28*1596Szelenkov@nginx.com        assert self.get_ssl(port=7081)['status'] == 201, 'https'
29