summaryrefslogtreecommitdiffhomepage
path: root/test/test_routing.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-03-03 17:54:02 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2020-03-03 17:54:02 +0000
commit3b7b2fae54b7c11e979552f13f7f315775673981 (patch)
tree1da64d1176b19382b20fde4f4be5c18e6adb2bcf /test/test_routing.py
parenta98de7f705f3b182fb405cced7ce85805bd6ffd3 (diff)
downloadunit-3b7b2fae54b7c11e979552f13f7f315775673981.tar.gz
unit-3b7b2fae54b7c11e979552f13f7f315775673981.tar.bz2
Tests: check unique options in "action" object.
Diffstat (limited to 'test/test_routing.py')
-rw-r--r--test/test_routing.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/test_routing.py b/test/test_routing.py
index f03c0bb3..be00d733 100644
--- a/test/test_routing.py
+++ b/test/test_routing.py
@@ -294,6 +294,56 @@ class TestRouting(TestApplicationProto):
'route pass absent configure',
)
+ def test_routes_action_unique(self):
+ self.assertIn(
+ 'success',
+ self.conf(
+ {
+ "listeners": {
+ "*:7080": {"pass": "routes"},
+ "*:7081": {"pass": "applications/app"},
+ },
+ "routes": [{"action": {"proxy": "http://127.0.0.1:7081"}}],
+ "applications": {
+ "app": {
+ "type": "python",
+ "processes": {"spare": 0},
+ "path": "/app",
+ "module": "wsgi",
+ }
+ },
+ }
+ ),
+ )
+
+ self.assertIn(
+ 'error',
+ self.conf(
+ {"proxy": "http://127.0.0.1:7081", "share": self.testdir},
+ 'routes/0/action',
+ ),
+ 'proxy share',
+ )
+ self.assertIn(
+ 'error',
+ self.conf(
+ {
+ "proxy": "http://127.0.0.1:7081",
+ "pass": "applications/app",
+ },
+ 'routes/0/action',
+ ),
+ 'proxy pass',
+ )
+ self.assertIn(
+ 'error',
+ self.conf(
+ {"share": self.testdir, "pass": "applications/app"},
+ 'routes/0/action',
+ ),
+ 'share pass',
+ )
+
def test_routes_rules_two(self):
self.assertIn(
'success',