gavo.helpers.trialhelpers module¶
Helpers for trial-based tests, in particular retrieving pages.
- class gavo.helpers.trialhelpers.ArchiveTest(methodName='runTest')[source]¶
Bases:
RenderTest
the main class for writing trial-based tests in DaCHS.
It comes preconfigured to handle URLs as the running server and will return roughly the same error responses.
It also has a method to XSD-validate documents against DaCHS’ built-in schemas.
- static errorHandler(flr, request)¶
renders a resource a twisted failure.
This finishes request itself. It returns t.w.server.NOT_DONE_YET because of that, so you can write return renderDCErrorPage from a render method (or similar).
- renderer = <gavo.web.root.ArchiveService object>¶
- class gavo.helpers.trialhelpers.FakeRequest(uri=b'', headers=None, args=None, avatar=None, currentSegments=None, cookies=None, user='', password='', isSecure=False)[source]¶
Bases:
FakeRequest
,Request
- gavo.helpers.trialhelpers.makeRequestArgs(aDict=None, **kwargs)[source]¶
returns a request.args compatible dict form aDict.
In particular, simple values will be put into lists.
- gavo.helpers.trialhelpers.provideRDData(rdName, ddId, _imported={})[source]¶
makes ddId from rdName and returns a cleanup function.
This is for creating temporary data for tests; it’s supposed to be used as in:
atexit.register(provideRDData("test", "import_fitsprod"))
This keeps track of (rdName, ddId) pairs it’s already loaded and doesn’t import them again.