Deleted
Added
test_access_log.py (1028:2201c3f83ae3) | test_access_log.py (1029:687f7cc7aae2) |
---|---|
1import os 2import re 3import time 4from subprocess import call 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestAccessLog(TestApplicationPython): --- 5 unchanged lines hidden (view full) --- 14 self.conf('"' + self.testdir + '/access.log"', 'access_log') 15 16 def wait_for_record(self, pattern, name='access.log'): 17 return super().wait_for_record(pattern, name) 18 19 def test_access_log_keepalive(self): 20 self.load('mirror') 21 | 1import os 2import re 3import time 4from subprocess import call 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestAccessLog(TestApplicationPython): --- 5 unchanged lines hidden (view full) --- 14 self.conf('"' + self.testdir + '/access.log"', 'access_log') 15 16 def wait_for_record(self, pattern, name='access.log'): 17 return super().wait_for_record(pattern, name) 18 19 def test_access_log_keepalive(self): 20 self.load('mirror') 21 |
22 self.assertEqual(self.get()['status'], 200, 'init') 23 |
|
22 (resp, sock) = self.post( 23 headers={ 24 'Host': 'localhost', 25 'Connection': 'keep-alive', 26 'Content-Type': 'text/html', 27 }, 28 start=True, 29 body='01234', | 24 (resp, sock) = self.post( 25 headers={ 26 'Host': 'localhost', 27 'Connection': 'keep-alive', 28 'Content-Type': 'text/html', 29 }, 30 start=True, 31 body='01234', |
32 read_timeout=1, |
|
30 ) 31 32 self.assertIsNotNone( 33 self.wait_for_record(r'"POST / HTTP/1.1" 200 5'), 'keepalive 1' 34 ) 35 36 resp = self.post( 37 headers={ --- 131 unchanged lines hidden (view full) --- 169 170 self.assertIsNotNone( 171 self.wait_for_record(r'"GET / HTTP/1.0" 200 0 "-" "-"'), 'http 1.0' 172 ) 173 174 def test_access_log_partial(self): 175 self.load('empty') 176 | 33 ) 34 35 self.assertIsNotNone( 36 self.wait_for_record(r'"POST / HTTP/1.1" 200 5'), 'keepalive 1' 37 ) 38 39 resp = self.post( 40 headers={ --- 131 unchanged lines hidden (view full) --- 172 173 self.assertIsNotNone( 174 self.wait_for_record(r'"GET / HTTP/1.0" 200 0 "-" "-"'), 'http 1.0' 175 ) 176 177 def test_access_log_partial(self): 178 self.load('empty') 179 |
177 self.http(b"""GE""", raw=True) | 180 self.http(b"""GE""", raw=True, no_recv=True) |
178 179 self.stop() 180 181 self.assertIsNotNone( 182 self.wait_for_record(r'"GE" 400 0 "-" "-"'), 'partial' 183 ) 184 185 def test_access_log_partial_2(self): 186 self.load('empty') 187 | 181 182 self.stop() 183 184 self.assertIsNotNone( 185 self.wait_for_record(r'"GE" 400 0 "-" "-"'), 'partial' 186 ) 187 188 def test_access_log_partial_2(self): 189 self.load('empty') 190 |
188 self.http(b"""GET /\n""", raw=True) | 191 self.http(b"""GET /\n""", raw=True, no_recv=True) |
189 190 self.stop() 191 192 self.assertIsNotNone( 193 self.wait_for_record(r'"GET /" 400 \d+ "-" "-"'), 'partial 2' 194 ) 195 196 def test_access_log_partial_3(self): 197 self.load('empty') 198 | 192 193 self.stop() 194 195 self.assertIsNotNone( 196 self.wait_for_record(r'"GET /" 400 \d+ "-" "-"'), 'partial 2' 197 ) 198 199 def test_access_log_partial_3(self): 200 self.load('empty') 201 |
199 self.http(b"""GET / HTTP/1.1""", raw=True) | 202 self.http(b"""GET / HTTP/1.1""", raw=True, no_recv=True) |
200 201 self.stop() 202 203 self.assertIsNotNone( 204 self.wait_for_record(r'"GET /" 400 0 "-" "-"'), 'partial 3' 205 ) 206 207 def test_access_log_partial_4(self): 208 self.load('empty') 209 | 203 204 self.stop() 205 206 self.assertIsNotNone( 207 self.wait_for_record(r'"GET /" 400 0 "-" "-"'), 'partial 3' 208 ) 209 210 def test_access_log_partial_4(self): 211 self.load('empty') 212 |
210 resp = self.http(b"""GET / HTTP/1.1\n""", raw=True) | 213 resp = self.http(b"""GET / HTTP/1.1\n""", raw=True, no_recv=True) |
211 212 self.stop() 213 214 self.assertIsNotNone( 215 self.wait_for_record(r'"GET / HTTP/1.1" 400 0 "-" "-"'), 216 'partial 4', 217 ) 218 219 def test_access_log_partial_5(self): 220 self.load('empty') 221 | 214 215 self.stop() 216 217 self.assertIsNotNone( 218 self.wait_for_record(r'"GET / HTTP/1.1" 400 0 "-" "-"'), 219 'partial 4', 220 ) 221 222 def test_access_log_partial_5(self): 223 self.load('empty') 224 |
222 self.http(b"""GET / HTTP/1.1\n\n""", raw=True) | 225 self.assertEqual(self.post()['status'], 200, 'init') |
223 | 226 |
227 self.http(b"""GET / HTTP/1.1\n\n""", raw=True, read_timeout=1) 228 |
|
224 self.stop() 225 226 self.assertIsNotNone( 227 self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "-" "-"'), 228 'partial 5', 229 ) 230 231 def test_access_log_get_parameters(self): --- 81 unchanged lines hidden --- | 229 self.stop() 230 231 self.assertIsNotNone( 232 self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "-" "-"'), 233 'partial 5', 234 ) 235 236 def test_access_log_get_parameters(self): --- 81 unchanged lines hidden --- |