MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_accept

Method test_accept

Lib/test/test_httpservers.py:1207–1223  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
1226class SocketlessRequestHandler(SimpleHTTPRequestHandler):

Callers

nothing calls this directly

Calls 7

OrderedDictClass · 0.90
subTestMethod · 0.80
assertInMethod · 0.80
requestMethod · 0.45
assertEqualMethod · 0.45
encodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected