assembl.tests.utils package

Module contents

All utility methods, classes and functions needed for testing applications

class assembl.tests.utils.PyramidWebTestRequest(*args, **kwargs)[source]

Bases: webtest.app.TestRequest

A mock Pyramid web request this pushes itself onto the threadlocal stack that also contains the user_id according to authentication model. This is very useful because throughout the model logic, a request is often required to determine the current_user, but outside of a Pyramid view. The way a request is injected is via the current_thread from threadlocal.

get_response(app, catch_exc_info=True)[source]

Like .call_application(application), except returns a response object with .status, .headers, and .body attributes.

This will use self.ResponseClass to figure out the class of the response object to return.

If application is not given, this will send the request to self.make_default_send_app()

class assembl.tests.utils.RecordingApp(test_app)[source]

Bases: object

Decorator for the test_app

assembl.tests.utils.api_call_to_fname(api_call, method='GET', **args)[source]

Translate an API call to a filename containing most of the call information

Used in ajaxMock()