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

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

317
318 self.assertEqual(self.get()['body'], 'body\n', 'body file')
319
320 def test_ruby_keepalive_body(self):
321 self.load('mirror')
322
323 self.assertEqual(self.get()['status'], 200, 'init')
324
1import unittest
2from unit.applications.lang.ruby import TestApplicationRuby
3
4
5class TestRubyApplication(TestApplicationRuby):
6 prerequisites = {'modules': ['ruby']}
7
8 def test_ruby_application(self):

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

317
318 self.assertEqual(self.get()['body'], 'body\n', 'body file')
319
320 def test_ruby_keepalive_body(self):
321 self.load('mirror')
322
323 self.assertEqual(self.get()['status'], 200, 'init')
324
325 body = '0123456789' * 500
325 (resp, sock) = self.post(
326 headers={
327 'Host': 'localhost',
328 'Connection': 'keep-alive',
329 'Content-Type': 'text/html',
330 },
331 start=True,
326 (resp, sock) = self.post(
327 headers={
328 'Host': 'localhost',
329 'Connection': 'keep-alive',
330 'Content-Type': 'text/html',
331 },
332 start=True,
332 body='0123456789' * 500,
333 body=body,
333 read_timeout=1,
334 )
335
334 read_timeout=1,
335 )
336
336 self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1')
337 self.assertEqual(resp['body'], body, 'keep-alive 1')
337
338
339 body = '0123456789'
338 resp = self.post(
339 headers={
340 'Host': 'localhost',
341 'Connection': 'close',
342 'Content-Type': 'text/html',
343 },
344 sock=sock,
340 resp = self.post(
341 headers={
342 'Host': 'localhost',
343 'Connection': 'close',
344 'Content-Type': 'text/html',
345 },
346 sock=sock,
345 body='0123456789',
347 body=body,
346 )
347
348 )
349
348 self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')
350 self.assertEqual(resp['body'], body, 'keep-alive 2')
349
350 def test_ruby_application_constants(self):
351 self.load('constants')
352
353 resp = self.get()
354
355 self.assertEqual(resp['status'], 200, 'status')
356

--- 19 unchanged lines hidden ---
351
352 def test_ruby_application_constants(self):
353 self.load('constants')
354
355 resp = self.get()
356
357 self.assertEqual(resp['status'], 200, 'status')
358

--- 19 unchanged lines hidden ---