diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-22 14:00:37 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:00 -0500 |
commit | 9f48612a56b6e760aa06a9af2071f1b50f413f27 (patch) | |
tree | 3497a7a1ac14d73f785d28fbb2a5e542c03e1534 /tests | |
parent | 46c10d4608508de01a65d6e6076104d88c63b253 (diff) | |
download | freeipa-9f48612a56b6e760aa06a9af2071f1b50f413f27.tar.gz freeipa-9f48612a56b6e760aa06a9af2071f1b50f413f27.tar.xz freeipa-9f48612a56b6e760aa06a9af2071f1b50f413f27.zip |
Sundry work getting ready to switch to new XML-RPC client/server code
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_ipalib/test_rpc.py | 16 | ||||
-rw-r--r-- | tests/util.py | 7 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_ipalib/test_rpc.py b/tests/test_ipalib/test_rpc.py index bc8936ab6..30175e3bf 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. diff --git a/tests/util.py b/tests/util.py index f5899dfab..631d4a05c 100644 --- a/tests/util.py +++ b/tests/util.py @@ -295,6 +295,13 @@ class PluginTester(object): o = api[namespace][self.plugin.__name__] return (o, api, home) + def tearDown(self): + """ + nose tear-down fixture. + """ + for name in context.__dict__.keys(): + delattr(context, name) + class dummy_ugettext(object): __called = False |