Files
nginx-unit/test/test_routing_tls.py
Andrei Zeliankou ce2405ec3d Tests: prerequisites checking reworked.
Prerequisites check moved to the module level to simplify class structure.
Discovery and prerequisites checks functions moved to the separate files.
Introduced "require" fixture to provide per-test requirements check.
2023-06-12 14:16:59 +01:00

29 lines
928 B
Python

from unit.applications.tls import TestApplicationTLS
prerequisites = {'modules': {'openssl': 'any'}}
class TestRoutingTLS(TestApplicationTLS):
def test_routes_match_scheme_tls(self):
self.certificate()
assert 'success' in self.conf(
{
"listeners": {
"*:7080": {"pass": "routes"},
"*:7081": {
"pass": "routes",
"tls": {"certificate": 'default'},
},
},
"routes": [
{"match": {"scheme": "http"}, "action": {"return": 200}},
{"match": {"scheme": "https"}, "action": {"return": 201}},
],
"applications": {},
}
), 'scheme configure'
assert self.get()['status'] == 200, 'http'
assert self.get_ssl(port=7081)['status'] == 201, 'https'