---
name: "Web::MREST::Test"
section: "3pm"
platform: "linux"
package: "libweb-mrest-perl"
version: "0.290-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Web::MREST::Test"
---

# Web::MREST::Test(3pm)

Test helper functions

## NAME

Web::MREST::Test - Test helper functions

## 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 generator

### docu\_check

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