On Wed, Mar 25, 2009 at 11:44 AM, Bryan <[email protected]> wrote:
>
> I am trying to write some unit tests for an XMLRPCController.  I am
> trying to use xmlrpclib to do this.  I don't know what URI to pass
> into ServerProxy.
>
> from xmlrpclib import ServerProxy
> server = ServerProxy('http://ipaddress:port/xmlrpc/')
> server.system.listMethods()
>
> raises a 'Connection refused' error.

Connection refused means you passed it an address correctly but the
connection was, eh, refused.

However, for testing you may want to use a mock object to temporarily
replace the xmlrpclib ServerProxy so that it doesn't go out into the
Internet when you run your tests.  I wrote a module named Fudge for
exactly this kind of situation -- http://farmdev.com/projects/fudge/
-- but there are a lot of other similar libraries for Python available
via your favorite search engine.

K

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to