Sundry work getting ready to switch to new XML-RPC client/server code

This commit is contained in:
Jason Gerard DeRose
2009-01-22 14:00:37 -07:00
committed by Rob Crittenden
parent 46c10d4608
commit 9f48612a56
5 changed files with 132 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ Test the `ipalib.rpc` module.
"""
import threading
from xmlrpclib import Binary, Fault, dumps, loads
from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy
from tests.util import raises, assert_equal, PluginTester, DummyClass
from tests.data import binary_bytes, utf8_bytes, unicode_str
from ipalib.frontend import Command
@@ -184,6 +184,20 @@ class test_xmlclient(PluginTester):
"""
_plugin = rpc.xmlclient
def test_connect(self):
(o, api, home) = self.instance('Backend', in_server=False)
# Test that StandardError is raised if conntext.xmlconn already exists:
context.xmlconn = 'The xmlrpclib.ServerProxy instance'
e = raises(StandardError, o.connect)
assert str(e) == '%s.connect(): context.%s already exists in thread %r' % (
'xmlclient', 'xmlconn', threading.currentThread().getName()
)
del context.xmlconn
o.connect()
assert isinstance(context.xmlconn, ServerProxy)
def test_forward(self):
"""
Test the `ipalib.rpc.xmlclient.forward` method.