test_php_application.py (1381:6c76371a7a75) test_php_application.py (1453:71af60a59338)
1import os
2import re
3import shutil
4import unittest
5from unit.applications.lang.php import TestApplicationPHP
6
7class TestPHPApplication(TestApplicationPHP):
8 prerequisites = {'modules': ['php']}

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

178 resp['body'], r'<title>404 Not Found</title>', '404 body'
179 )
180
181 def test_php_application_keepalive_body(self):
182 self.load('mirror')
183
184 self.assertEqual(self.get()['status'], 200, 'init')
185
1import os
2import re
3import shutil
4import unittest
5from unit.applications.lang.php import TestApplicationPHP
6
7class TestPHPApplication(TestApplicationPHP):
8 prerequisites = {'modules': ['php']}

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

178 resp['body'], r'<title>404 Not Found</title>', '404 body'
179 )
180
181 def test_php_application_keepalive_body(self):
182 self.load('mirror')
183
184 self.assertEqual(self.get()['status'], 200, 'init')
185
186 body = '0123456789' * 500
186 (resp, sock) = self.post(
187 headers={
188 'Host': 'localhost',
189 'Connection': 'keep-alive',
190 'Content-Type': 'text/html',
191 },
192 start=True,
187 (resp, sock) = self.post(
188 headers={
189 'Host': 'localhost',
190 'Connection': 'keep-alive',
191 'Content-Type': 'text/html',
192 },
193 start=True,
193 body='0123456789' * 500,
194 body=body,
194 read_timeout=1,
195 )
196
195 read_timeout=1,
196 )
197
197 self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1')
198 self.assertEqual(resp['body'], body, 'keep-alive 1')
198
199
200 body = '0123456789'
199 resp = self.post(
200 headers={
201 'Host': 'localhost',
202 'Connection': 'close',
203 'Content-Type': 'text/html',
204 },
205 sock=sock,
201 resp = self.post(
202 headers={
203 'Host': 'localhost',
204 'Connection': 'close',
205 'Content-Type': 'text/html',
206 },
207 sock=sock,
206 body='0123456789',
208 body=body,
207 )
208
209 )
210
209 self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')
211 self.assertEqual(resp['body'], body, 'keep-alive 2')
210
211 def test_php_application_conditional(self):
212 self.load('conditional')
213
214 self.assertRegex(self.get()['body'], r'True', 'conditional true')
215 self.assertRegex(self.post()['body'], r'False', 'conditional false')
216
217 def test_php_application_get_variables(self):

--- 456 unchanged lines hidden ---
212
213 def test_php_application_conditional(self):
214 self.load('conditional')
215
216 self.assertRegex(self.get()['body'], r'True', 'conditional true')
217 self.assertRegex(self.post()['body'], r'False', 'conditional false')
218
219 def test_php_application_get_variables(self):

--- 456 unchanged lines hidden ---