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

Method test_cgi_xmlrpc_response

Lib/test/test_xmlrpc.py:1463–1503  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1461
1462
1463 def test_cgi_xmlrpc_response(self):
1464 data = """<?xml version='1.0'?>
1465 <methodCall>
1466 <methodName>test_method</methodName>
1467 <params>
1468 <param>
1469 <value><string>foo</string></value>
1470 </param>
1471 <param>
1472 <value><string>bar</string></value>
1473 </param>
1474 </params>
1475 </methodCall>
1476 """
1477
1478 with os_helper.EnvironmentVarGuard() as env, \
1479 captured_stdout(encoding=self.cgi.encoding) as data_out, \
1480 support.captured_stdin() as data_in:
1481 data_in.write(data)
1482 data_in.seek(0)
1483 env['CONTENT_LENGTH'] = str(len(data))
1484 self.cgi.handle_request()
1485 data_out.seek(0)
1486
1487 # will respond exception, if so, our goal is achieved ;)
1488 handle = data_out.read()
1489
1490 # start with 44th char so as not to get http header, we just
1491 # need only xml
1492 self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, handle[44:])
1493
1494 # Also test the content-length returned by handle_request
1495 # Using the same test method inorder to avoid all the datapassing
1496 # boilerplate code.
1497 # Test for bug: http://bugs.python.org/issue5040
1498
1499 content = handle[handle.find("<?xml"):]
1500
1501 self.assertEqual(
1502 int(re.search(r'Content-Length: (\d+)', handle).group(1)),
1503 len(content))
1504
1505
1506class UseBuiltinTypesTestCase(unittest.TestCase):

Callers

nothing calls this directly

Calls 12

strFunction · 0.85
lenFunction · 0.85
captured_stdoutFunction · 0.70
writeMethod · 0.45
seekMethod · 0.45
handle_requestMethod · 0.45
readMethod · 0.45
assertRaisesMethod · 0.45
findMethod · 0.45
assertEqualMethod · 0.45
groupMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected