Package gavo :: Package helpers :: Module trialhelpers
[frames] | no frames]

Module trialhelpers

source code

Helpers for trial-based tests, in particular retrieving pages.

Classes
  FakeFieldStorage
  FakeRequest
A Request for testing purpuses.
  RenderTest
a base class for tests of twisted web resources.
  ArchiveTest
Functions
 
getRequestContext(path, method='GET', args=None, requestMogrifier=None, requestClass=??) source code
 
runQuery(page, method, path, args, requestMogrifier=None, requestClass=??)
runs a query on a page.
source code
 
getImportConnection(*args) source code
 
provideRDData(rdName, ddId, _imported=set([]))
makes ddId from rdName and returns a cleanup function.
source code
Variables
  __package__ = 'gavo.helpers'
Function Details

runQuery(page, method, path, args, requestMogrifier=None, requestClass=??)

source code 

runs a query on a page.

The query should look like it's coming from localhost.

The thing returns a deferred firing a pair of the result (a string) and the request (from which you can glean headers and such).

getImportConnection(*args)

source code 
Decorators:
  • @utils.memoized

provideRDData(rdName, ddId, _imported=set([]))

source code 

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.