summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xmlrpc.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-10-11 16:09:51 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-10-11 16:09:51 (GMT)
commitaaf17b33a53447f45d799d1165765b60adad8209 (patch)
treee942cc5b86c191bde7ce015962acb92a6cc966c3 /Lib/test/test_xmlrpc.py
parent1254b407ac6960ff2594e417d2f1c2c6a1ffc755 (diff)
downloadcpython-aaf17b33a53447f45d799d1165765b60adad8209.zip
cpython-aaf17b33a53447f45d799d1165765b60adad8209.tar.gz
cpython-aaf17b33a53447f45d799d1165765b60adad8209.tar.bz2
#19192: Give up on time.xmlrpc.com as an xmlrpc network test.
time.xmlrpc.com has come and gone over the years, and has been gone again for a while. The test did test one thing that the current xmlrpc tests don't: the use of multiple levels of attribute names in the call. So in addition to removing the network test, we add a test in xmlrpc of dotted name access. There should also be a test for when dotted name access is disallowed, but that requires more extensive test harness refactoring, and in any case was not tested by the network test we are deleting, since it is a server-side setting. This is a slightly simplified version of a patch by Vajrasky Kok.
Diffstat (limited to 'Lib/test/test_xmlrpc.py')
-rw-r--r--Lib/test/test_xmlrpc.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 7fc52e3..99b3eda 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -380,6 +380,11 @@ def http_server(evt, numrequests, requestHandler=None):
if name == 'div':
return 'This is the div function'
+ class Fixture:
+ @staticmethod
+ def getData():
+ return '42'
+
def my_function():
'''This is my function'''
return True
@@ -411,7 +416,8 @@ def http_server(evt, numrequests, requestHandler=None):
serv.register_function(pow)
serv.register_function(lambda x,y: x+y, 'add')
serv.register_function(my_function)
- serv.register_instance(TestInstanceClass())
+ testInstance = TestInstanceClass()
+ serv.register_instance(testInstance, allow_dotted_names=True)
evt.set()
# handle up to 'numrequests' requests
@@ -591,7 +597,8 @@ class SimpleServerTestCase(BaseServerTestCase):
def test_introspection1(self):
expected_methods = set(['pow', 'div', 'my_function', 'add',
'system.listMethods', 'system.methodHelp',
- 'system.methodSignature', 'system.multicall'])
+ 'system.methodSignature', 'system.multicall',
+ 'Fixture'])
try:
p = xmlrpclib.ServerProxy(URL)
meth = p.system.listMethods()
@@ -690,6 +697,12 @@ class SimpleServerTestCase(BaseServerTestCase):
# This avoids waiting for the socket timeout.
self.test_simple1()
+ def test_allow_dotted_names_true(self):
+ # XXX also need allow_dotted_names_false test.
+ server = xmlrpclib.ServerProxy("http://%s:%d/RPC2" % (ADDR, PORT))
+ data = server.Fixture.getData()
+ self.assertEqual(data, '42')
+
def test_unicode_host(self):
server = xmlrpclib.ServerProxy("http://%s:%d/RPC2" % (ADDR, PORT))
self.assertEqual(server.add("a", "\xe9"), "a\xe9")