test_return.py (1435:b7131bfeb438) test_return.py (1441:b2caecb224f7)
1import re
2import unittest
3from unit.applications.proto import TestApplicationProto
4
5
6class TestReturn(TestApplicationProto):
7 prerequisites = {}
8

--- 167 unchanged lines hidden (view full) ---

176 self.assertEqual(self.get()['headers']['Location'], 'blah')
177
178 def test_return_invalid(self):
179 def check_error(conf):
180 self.assertIn('error', self.conf(conf, 'routes/0/action'))
181
182 check_error({"return": "200"})
183 check_error({"return": []})
1import re
2import unittest
3from unit.applications.proto import TestApplicationProto
4
5
6class TestReturn(TestApplicationProto):
7 prerequisites = {}
8

--- 167 unchanged lines hidden (view full) ---

176 self.assertEqual(self.get()['headers']['Location'], 'blah')
177
178 def test_return_invalid(self):
179 def check_error(conf):
180 self.assertIn('error', self.conf(conf, 'routes/0/action'))
181
182 check_error({"return": "200"})
183 check_error({"return": []})
184 check_error({"return": 80.})
184 check_error({"return": 80.1})
185 check_error({"return": 1000})
186 check_error({"return": 200, "share": "/blah"})
187
188 self.assertIn(
189 'error', self.conf('001', 'routes/0/action/return'), 'leading zero'
190 )
191
192 check_error({"return": 301, "location": 0})
193 check_error({"return": 301, "location": []})
194
195
196if __name__ == '__main__':
197 TestReturn.main()
185 check_error({"return": 1000})
186 check_error({"return": 200, "share": "/blah"})
187
188 self.assertIn(
189 'error', self.conf('001', 'routes/0/action/return'), 'leading zero'
190 )
191
192 check_error({"return": 301, "location": 0})
193 check_error({"return": 301, "location": []})
194
195
196if __name__ == '__main__':
197 TestReturn.main()