Deleted
Added
test_return.py (2083:6012aa060ec5) | test_return.py (2099:110766ffd5d9) |
---|---|
1import re 2 3from unit.applications.proto import TestApplicationProto 4 5 6class TestReturn(TestApplicationProto): 7 prerequisites = {} 8 --- 164 unchanged lines hidden (view full) --- 173 174 assert ( 175 self.get(headers={"Host": "#foo?bar", "Connection": "close"})[ 176 'headers' 177 ]['Location'] 178 == "/#%23foo%3Fbar" 179 ), 'location with a variable with encoding' 180 | 1import re 2 3from unit.applications.proto import TestApplicationProto 4 5 6class TestReturn(TestApplicationProto): 7 prerequisites = {} 8 --- 164 unchanged lines hidden (view full) --- 173 174 assert ( 175 self.get(headers={"Host": "#foo?bar", "Connection": "close"})[ 176 'headers' 177 ]['Location'] 178 == "/#%23foo%3Fbar" 179 ), 'location with a variable with encoding' 180 |
181 assert 'success' in self.conf( 182 '""', 'routes/0/action/location' 183 ), 'location empty' 184 assert self.get()['headers']['Location'] == '' 185 186 assert 'success' in self.conf( 187 '"${host}"', 'routes/0/action/location' 188 ), 'location empty with variable' 189 assert ( 190 self.get(headers={"Host": "", "Connection": "close"})['headers'][ 191 'Location' 192 ] 193 == "" 194 ), 'location with empty variable' 195 |
|
181 def test_return_invalid(self): 182 def check_error(conf): 183 assert 'error' in self.conf(conf, 'routes/0/action') 184 185 check_error({"return": "200"}) 186 check_error({"return": []}) 187 check_error({"return": 80.1}) 188 check_error({"return": 1000}) 189 check_error({"return": -1}) 190 check_error({"return": 200, "share": "/blah"}) 191 check_error({"return": 200, "location": "$hos"}) 192 check_error({"return": 200, "location": "$hostblah"}) 193 194 assert 'error' in self.conf( 195 '001', 'routes/0/action/return' 196 ), 'leading zero' 197 198 check_error({"return": 301, "location": 0}) 199 check_error({"return": 301, "location": []}) | 196 def test_return_invalid(self): 197 def check_error(conf): 198 assert 'error' in self.conf(conf, 'routes/0/action') 199 200 check_error({"return": "200"}) 201 check_error({"return": []}) 202 check_error({"return": 80.1}) 203 check_error({"return": 1000}) 204 check_error({"return": -1}) 205 check_error({"return": 200, "share": "/blah"}) 206 check_error({"return": 200, "location": "$hos"}) 207 check_error({"return": 200, "location": "$hostblah"}) 208 209 assert 'error' in self.conf( 210 '001', 'routes/0/action/return' 211 ), 'leading zero' 212 213 check_error({"return": 301, "location": 0}) 214 check_error({"return": 301, "location": []}) |