test_perl_application.py (1295:f60a68728306) test_perl_application.py (1453:71af60a59338)
1import unittest
2from unit.applications.lang.perl import TestApplicationPerl
3
4
5class TestPerlApplication(TestApplicationPerl):
6 prerequisites = {'modules': ['perl']}
7
8 def test_perl_application(self):

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

192
193 self.assertEqual(self.get()['status'], 500, 'syntax error')
194
195 def test_perl_keepalive_body(self):
196 self.load('variables')
197
198 self.assertEqual(self.get()['status'], 200, 'init')
199
1import unittest
2from unit.applications.lang.perl import TestApplicationPerl
3
4
5class TestPerlApplication(TestApplicationPerl):
6 prerequisites = {'modules': ['perl']}
7
8 def test_perl_application(self):

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

192
193 self.assertEqual(self.get()['status'], 500, 'syntax error')
194
195 def test_perl_keepalive_body(self):
196 self.load('variables')
197
198 self.assertEqual(self.get()['status'], 200, 'init')
199
200 body = '0123456789' * 500
200 (resp, sock) = self.post(
201 headers={
202 'Host': 'localhost',
203 'Connection': 'keep-alive',
204 'Content-Type': 'text/html',
205 },
206 start=True,
201 (resp, sock) = self.post(
202 headers={
203 'Host': 'localhost',
204 'Connection': 'keep-alive',
205 'Content-Type': 'text/html',
206 },
207 start=True,
207 body='0123456789' * 500,
208 body=body,
208 read_timeout=1,
209 )
210
209 read_timeout=1,
210 )
211
211 self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1')
212 self.assertEqual(resp['body'], body, 'keep-alive 1')
212
213
214 body = '0123456789'
213 resp = self.post(
214 headers={
215 'Host': 'localhost',
216 'Connection': 'close',
217 'Content-Type': 'text/html',
218 },
219 sock=sock,
215 resp = self.post(
216 headers={
217 'Host': 'localhost',
218 'Connection': 'close',
219 'Content-Type': 'text/html',
220 },
221 sock=sock,
220 body='0123456789',
222 body=body,
221 )
222
223 )
224
223 self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')
225 self.assertEqual(resp['body'], body, 'keep-alive 2')
224
225 def test_perl_body_io_fake(self):
226 self.load('body_io_fake')
227
228 self.assertEqual(self.get()['body'], '21', 'body io fake')
229
230 self.assertIsNotNone(
231 self.wait_for_record(r'\[error\].+IOFake getline\(\) \$\/ is \d+'),

--- 27 unchanged lines hidden ---
226
227 def test_perl_body_io_fake(self):
228 self.load('body_io_fake')
229
230 self.assertEqual(self.get()['body'], '21', 'body io fake')
231
232 self.assertIsNotNone(
233 self.wait_for_record(r'\[error\].+IOFake getline\(\) \$\/ is \d+'),

--- 27 unchanged lines hidden ---