From 9f48612a56b6e760aa06a9af2071f1b50f413f27 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 22 Jan 2009 14:00:37 -0700 Subject: Sundry work getting ready to switch to new XML-RPC client/server code --- tests/test_ipalib/test_rpc.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/test_ipalib/test_rpc.py') diff --git a/tests/test_ipalib/test_rpc.py b/tests/test_ipalib/test_rpc.py index bc8936ab..30175e3b 100644 --- a/tests/test_ipalib/test_rpc.py +++ b/tests/test_ipalib/test_rpc.py @@ -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. -- cgit