[Twisted-Python] Running the same trial test suite against a live server and a mock server

Laurens Van Houtven _ at lvh.cc
Mon Sep 26 07:37:16 EDT 2011


Hey,


In order to properly test txievery (a twisted library for dealing with
Paypal's APIs), I'm building a mock Paypal server. The idea is to run the
same high-level tests (which basically use the API and eventually make it
make real HTTPS requests) against both the mock server and the Paypal
Sandbox.

The problem is that using the Paypal Sandbox requires extra information:
specifically, username, password, and an SSL certificate (I don't intend to
support "signature" authentication. It's a horrible alternative for
environments too stupid to make requests given a client cert).  My mock
sandbox also requires all of that, but I just have fake credentials. When
you run the test suite against the Paypal Sandbox, obviously you're going to
need Paypal-blessed credentials.

The obvious solution is to have a makeClient function defined in module
scope for the given test module. I could then have a bin/liveTest.py that
takes a username, password and cert, and monkeypatches that module. I'm
assuming it can't be hard to tell trial to just take a test module and run
it...

Are there any better ways to pass test data to trial?

cheers
lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110926/4a1eab69/attachment.htm 


More information about the Twisted-Python mailing list