(self)
| 1205 | CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin') |
| 1206 | |
| 1207 | def test_accept(self): |
| 1208 | browser_accept = \ |
| 1209 | 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' |
| 1210 | tests = ( |
| 1211 | ((('Accept', browser_accept),), browser_accept), |
| 1212 | ((), ''), |
| 1213 | # Hack case to get two values for the one header |
| 1214 | ((('Accept', 'text/html'), ('ACCEPT', 'text/plain')), |
| 1215 | 'text/html,text/plain'), |
| 1216 | ) |
| 1217 | for headers, expected in tests: |
| 1218 | headers = OrderedDict(headers) |
| 1219 | with self.subTest(headers): |
| 1220 | res = self.request('/cgi-bin/file6.py', 'GET', headers=headers) |
| 1221 | self.assertEqual(http.HTTPStatus.OK, res.status) |
| 1222 | expected = f"HTTP_ACCEPT={expected}".encode('ascii') |
| 1223 | self.assertIn(expected, res.read()) |
| 1224 | |
| 1225 | |
| 1226 | class SocketlessRequestHandler(SimpleHTTPRequestHandler): |
nothing calls this directly
no test coverage detected