diff options
author | Andrei Belov <defan@nginx.com> | 2019-08-22 21:33:54 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2019-08-22 21:33:54 +0300 |
commit | a07c4d30a64f781f93730576b5dced32422a9935 (patch) | |
tree | 06ebfaa66845a057b8069014c5379b2dcfc80861 /test/test_routing_tls.py | |
parent | 8a579acddeae0c0106e15d82aa7220ac01deba84 (diff) | |
parent | c47af243b0e805376c4ec908f21e07dc811b33f0 (diff) | |
download | unit-a07c4d30a64f781f93730576b5dced32422a9935.tar.gz unit-a07c4d30a64f781f93730576b5dced32422a9935.tar.bz2 |
Merged with the default branch.1.10.0-1
Diffstat (limited to '')
-rw-r--r-- | test/test_routing_tls.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/test_routing_tls.py b/test/test_routing_tls.py new file mode 100644 index 00000000..433a303e --- /dev/null +++ b/test/test_routing_tls.py @@ -0,0 +1,58 @@ +from unit.applications.tls import TestApplicationTLS + + +class TestRoutingTLS(TestApplicationTLS): + prerequisites = ['python', 'openssl'] + + def test_routes_match_scheme(self): + self.certificate() + + self.assertIn( + 'success', + self.conf( + { + "listeners": { + "*:7080": {"pass": "routes"}, + "*:7081": { + "pass": "routes", + "tls": {"certificate": 'default'}, + }, + }, + "routes": [ + { + "match": {"scheme": "http"}, + "action": {"pass": "applications/empty"}, + }, + { + "match": {"scheme": "https"}, + "action": {"pass": "applications/204_no_content"}, + }, + ], + "applications": { + "empty": { + "type": "python", + "processes": {"spare": 0}, + "path": self.current_dir + "/python/empty", + "module": "wsgi", + }, + "204_no_content": { + "type": "python", + "processes": {"spare": 0}, + "path": self.current_dir + + "/python/204_no_content", + "module": "wsgi", + }, + }, + } + ), + 'scheme configure', + ) + + self.assertEqual(self.get()['status'], 200, 'scheme http') + self.assertEqual( + self.get_ssl(port=7081)['status'], 204, 'scheme https' + ) + + +if __name__ == '__main__': + TestRoutingTLS.main() |