DESCRIPTION
This module provides helper code for unit tests.EXPORTS
PACKAGE VARIABLES
FUNCTIONS
initialize_unit
Perform the boilerplate tasks that have to be done at the beginning of every unit. Takes a PARAMHASH with two optional parameters:
'class' => class into which Web::Machine object is to be blessed 'sitedir' => sitedir parameter to be passed to Web::MREST::init
status_from_json
Web::MREST is designed to return status objects in the HTTP response entity. Before inclusion in the response, the status object is converted to JSON. This routine goes the opposite direction, taking a JSON string and converting it back into a status object.FIXME: There may be some encoding issues here!
req
Assemble and process a HTTP request. Takes the following positional arguments:
* Plack::Test object * expected HTTP result code * user to authenticate with (can be 'root', 'demo', or 'active') * HTTP method * resource string * optional JSON string
If the HTTP result code is 200, the return value will be a status object, undef otherwise.
llreq
Low-level request generatordocu_check
Check that the resource has on-line documentation (takes Plack::Test object and resource name without quotes)