Test Driven Development of XMLRPCControllers?

1 view
Skip to first unread message

avillena

unread,
Oct 10, 2008, 9:08:41 AM10/10/08
to pylons-devel
Hi!
Does anybody knows how to use paste.fixture facilities to tests and
XMLRPCController, in a similar way to testing regular controllers?
Thanks
Agustin

Jorge Vargas

unread,
Oct 10, 2008, 3:56:09 PM10/10/08
to pylons...@googlegroups.com


I'm not sure if this applies to paste.fixture, but I have done this
with webtest which is the replacement module for paste.fixture
(http://pythonpaste.org/webtest/)
And it is exactly the same as a normal test. except that you will
fetch the response with "response.json" and then do your thing.

Jorge Vargas

unread,
Oct 10, 2008, 3:57:57 PM10/10/08
to pylons...@googlegroups.com
sorry my parser corrected that XMLRPC to jsonrpc, I have been doing
this for way too long.
response.xml (Elementree) or response.lxml (lxml) is what you want.

avillena

unread,
Oct 14, 2008, 10:48:45 AM10/14/08
to pylons-devel
Thanks!
The doubt that remains is how I can send parameters to the
XMLRPCController. Using app.post giving an XML request document by
hand?
Any experience doing that?

Good luck
Agustin


On Oct 10, 4:57 pm, "Jorge Vargas" <jorge.var...@gmail.com> wrote:
> On Fri, Oct 10, 2008 at 1:56 PM, Jorge Vargas <jorge.var...@gmail.com> wrote:

Jorge Vargas

unread,
Oct 15, 2008, 12:14:49 PM10/15/08
to pylons...@googlegroups.com
On Tue, Oct 14, 2008 at 8:48 AM, avillena <agustin...@gmail.com> wrote:
>
> Thanks!
> The doubt that remains is how I can send parameters to the
> XMLRPCController. Using app.post giving an XML request document by
> hand?

you can pass a dict or a query_string as the second parameter to post,
which will be transformed into the POST data, so my guess is that you
need something in the likes of:
app.post("/url/to/controller/",{'data':xml_obj}) now two things are
uncertain, which is the value of data, I haven't used XMLRPController
that much to know the correct post parameter, and if you need to
escape or stringify xml_obj, I think the last one isn't needed, at
least it isn't for json objects. A quick peak at plyons
XMLRPCCOntroller suggest me you should be using xmlrpclib.dumps to
build a proper body for the request.

avillena

unread,
Oct 15, 2008, 8:19:37 PM10/15/08
to pylons-devel
Thanks

I'll try this

On 15 oct, 13:14, "Jorge Vargas" <jorge.var...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages