ulif.openoffice.testing – Helpers for testing¶
Test helpers.
-
class
ulif.openoffice.testing.ConvertLogCatcher¶ This log catcher catches the log messages of u.o.convert().
It must be instantiated before any call to u.o.convert.
-
class
ulif.openoffice.testing.FakeServerProxy(url)¶ An
xmlrpclib.ServerProxyfor doctests.Different to normal ServerProxy instances, this one uses a special transport to talk directly to the
ulif.openoffice.xmlrpc.WSGIXMLRPCApplicationset in xmlrpcapp.New in version 1.1.
-
class
ulif.openoffice.testing.HTTPWSGIResponse(webob_resp)¶ A fake httplib-like HTTP response.
Used by
WSGILikeHTTPfor use byWSGIXMLRPCAppTransport.New in version 1.1.
-
class
ulif.openoffice.testing.TestOOServerSetup(methodName='runTest')¶ A setup that starts an OO.org server in background
and shuts it down after tests in the accompanied test suite have been run.
This setup is special in that it detects whether an instance of the openoffice server is already running and in that case uses this instance.
For people running tests does that mean:
- You can decrease test time (dramatically) by starting oooctl in backgroud before running tests.
- An already running instance of OO.org server will be still running after tests.
- Be prepared for slightly different test output when using an already running OO.org server instance.
Note
This testcase works only with
unittest2! For more recent Python versions (Python >= 2.6) the defaultunittestmodule is sufficient.
-
class
ulif.openoffice.testing.WSGILikeHTTP(host, app)¶ An httplib-like HTTP layer for WSGIXMLRPCAppTransport.
New in version 1.1.
-
class
ulif.openoffice.testing.WSGIXMLRPCAppTransport(app)¶ A fake HTTP transport.
The given app should be the XMLRPC WSGI app to serve. Usually a
ulif.openoffice.xmlrpc.WSGIXMLRPCApplicationinstance.Usable by xmlrpclib clients to fake connections to ‘real’ servers like
xmlrpclib.SimpleXMLRPCServerinstances.With this transport you can create
xmlrpclib.ServerProxyinstances that talk directly to the given app instead of doing real network requests.New in version 1.1.
-
ulif.openoffice.testing.doctest_rm_resultdir(path)¶ Remove directory path.
If path is a file, the parent directory is removed.
The directory is only removed, if it is not the current working directory.
-
ulif.openoffice.testing.doctest_setup()¶ Set up doctest env.
Creates a temporary working dir and changes to it.
Creates a ‘document.doc’ file in that directory.
-
ulif.openoffice.testing.doctest_teardown()¶ Tear down doctest env.
Removes any temporary working directory (if it is different from initial CWD).
-
ulif.openoffice.testing.xmlrcpapp= None¶ A WSGIXMLRPCApplication instance for use by
FakeServerProxy. Set this var before creating aFakeServerProxyinstance and the proxy will send requests to the set application.