test_routing.py (1063:714437447f1f) test_routing.py (1064:75a64629661f)
1import unittest
2from unit.applications.proto import TestApplicationProto
3
4
5class TestRouting(TestApplicationProto):
6 prerequisites = ['python']
7
8 def setUp(self):

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

1050 ),
1051 'match uri normalize configure',
1052 )
1053
1054 self.assertEqual(
1055 self.get(url='/%62%6c%61%68')['status'], 200, 'match uri normalize'
1056 )
1057
1import unittest
2from unit.applications.proto import TestApplicationProto
3
4
5class TestRouting(TestApplicationProto):
6 prerequisites = ['python']
7
8 def setUp(self):

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

1050 ),
1051 'match uri normalize configure',
1052 )
1053
1054 self.assertEqual(
1055 self.get(url='/%62%6c%61%68')['status'], 200, 'match uri normalize'
1056 )
1057
1058 @unittest.expectedFailure
1059 def test_routes_match_empty_array(self):
1060 self.assertIn(
1061 'success',
1062 self.conf(
1063 [
1064 {
1065 "match": {"uri": []},
1066 "action": {"pass": "applications/empty"},

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

1072 )
1073
1074 self.assertEqual(
1075 self.get(url='/blah')['status'],
1076 200,
1077 'match empty array',
1078 )
1079
1058 def test_routes_match_empty_array(self):
1059 self.assertIn(
1060 'success',
1061 self.conf(
1062 [
1063 {
1064 "match": {"uri": []},
1065 "action": {"pass": "applications/empty"},

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

1071 )
1072
1073 self.assertEqual(
1074 self.get(url='/blah')['status'],
1075 200,
1076 'match empty array',
1077 )
1078
1080 @unittest.expectedFailure
1081 def test_routes_reconfigure(self):
1079 def test_routes_reconfigure(self):
1082 self.skip_sanitizer = True
1083 self.skip_alerts.extend(
1084 [
1085 r'failed to apply',
1086 r'process \d+ exited on signal',
1087 ]
1088 )
1089
1090 self.assertIn('success', self.conf([], 'routes'), 'routes redefine')
1091 self.assertEqual(self.get()['status'], 404, 'routes redefine request')
1092
1093 self.assertIn(
1094 'success',
1095 self.conf([{"action": {"pass": "applications/empty"}}], 'routes'),
1096 'routes redefine 2',
1097 )

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

1165
1166 self.assertEqual(
1167 len(self.conf_get('routes/main')), 2, 'routes redefine conf 8'
1168 )
1169 self.assertEqual(
1170 self.get()['status'], 200, 'routes redefine request 8'
1171 )
1172
1080 self.assertIn('success', self.conf([], 'routes'), 'routes redefine')
1081 self.assertEqual(self.get()['status'], 404, 'routes redefine request')
1082
1083 self.assertIn(
1084 'success',
1085 self.conf([{"action": {"pass": "applications/empty"}}], 'routes'),
1086 'routes redefine 2',
1087 )

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

1155
1156 self.assertEqual(
1157 len(self.conf_get('routes/main')), 2, 'routes redefine conf 8'
1158 )
1159 self.assertEqual(
1160 self.get()['status'], 200, 'routes redefine request 8'
1161 )
1162
1173 @unittest.expectedFailure
1174 def test_routes_edit(self):
1163 def test_routes_edit(self):
1175 self.skip_sanitizer = True
1176 self.skip_alerts.extend(
1177 [
1178 r'failed to apply',
1179 r'process \d+ exited on signal',
1180 ]
1181 )
1182
1183 self.assertIn(
1184 'success',
1185 self.conf(
1186 [
1187 {
1188 "match": {"method": "GET"},
1189 "action": {"pass": "applications/empty"},
1190 }

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

1316 'route edit configure 8',
1317 )
1318 self.assertIn(
1319 'success',
1320 self.conf_delete('routes/main'),
1321 'route edit configure 9',
1322 )
1323
1164 self.assertIn(
1165 'success',
1166 self.conf(
1167 [
1168 {
1169 "match": {"method": "GET"},
1170 "action": {"pass": "applications/empty"},
1171 }

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

1297 'route edit configure 8',
1298 )
1299 self.assertIn(
1300 'success',
1301 self.conf_delete('routes/main'),
1302 'route edit configure 9',
1303 )
1304
1324 @unittest.expectedFailure
1325 def test_match_edit(self):
1326 self.skip_alerts.append(r'failed to apply new conf')
1327
1328 self.assertIn(
1329 'success',
1330 self.conf(
1331 [
1332 {

--- 163 unchanged lines hidden ---
1305 def test_match_edit(self):
1306 self.skip_alerts.append(r'failed to apply new conf')
1307
1308 self.assertIn(
1309 'success',
1310 self.conf(
1311 [
1312 {

--- 163 unchanged lines hidden ---