DOKK / manpages / debian 12 / libweb-mrest-perl / Web::MREST::Test.3pm.en
Web::MREST::Test(3pm) User Contributed Perl Documentation Web::MREST::Test(3pm)

Web::MREST::Test - Test helper functions

This module provides helper code for unit tests.

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

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!

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.

Low-level request generator

Check that the resource has on-line documentation (takes Plack::Test object and resource name without quotes)

2022-09-21 perl v5.34.0