diff options
author | Andrew Clayton <andrew@digital-domain.net> | 2022-07-20 19:05:29 +0100 |
---|---|---|
committer | Andrew Clayton <andrew@digital-domain.net> | 2022-07-20 23:28:06 +0100 |
commit | 02659b1ee3b041d1f4046ac440ea6755455230a1 (patch) | |
tree | f305af12c7085dd3199cf5ae2ed593b23df3bcbd /test | |
parent | eebaff42eaef94f67f2232fc551f6d43c90c2e5c (diff) | |
download | unit-02659b1ee3b041d1f4046ac440ea6755455230a1.tar.gz unit-02659b1ee3b041d1f4046ac440ea6755455230a1.tar.bz2 |
Tests: added tests for translating $dollar into a literal $.
If you need to specify a $ in a URI you can now use '$dollar' or
'${dollar}'.
Added some tests for the above to test_variables.py setting a Location
string.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_variables.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_variables.py b/test/test_variables.py index ccd0839b..2ddfdc0a 100644 --- a/test/test_variables.py +++ b/test/test_variables.py @@ -114,6 +114,27 @@ class TestVariables(TestApplicationProto): check_user_agent('', 404) check_user_agent('no', 404) + def test_variables_dollar(self): + assert 'success' in self.conf( + { + "listeners": {"*:7080": {"pass": "routes"}}, + "routes": [{"action": {"return": 301}}], + } + ) + + def check_dollar(location, expect): + assert 'success' in self.conf( + '"' + location + '"', + 'routes/0/action/location', + ) + assert self.get()['headers']['Location'] == expect + + check_dollar( + 'https://${host}${uri}path${dollar}dollar', + 'https://localhost/path$dollar', + ) + check_dollar('path$dollar${dollar}', 'path$$') + def test_variables_many(self): self.conf_routes("\"routes$uri$method\"") assert self.get(url='/5')['status'] == 206, 'many' |