Web::MREST::Test(3pm)

πŸ“¦
version 0.290 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Web::MREST::Test πŸ’–

okay so bestie, welcome to Web::MREST::Test β€” that's the 3pm page, from the User Contributed Perl Documentation corner of the world. Sit down, grab a strawberry πŸ“, we're doing test helpers today.


✨ NAME ✨

Web::MREST::Test β€” test helper functions 🧚

Like, literally just helper functions. For tests. Bestie behavior only.


🌸 DESCRIPTION 🌸

This module provides helper code for unit tests. That's it, that's the whole vibe. It's the friend who shows up to your test suite with snacks and boilerplate so you don't have to write it yourself. 🫢


πŸ‘‘ EXPORTS πŸ‘‘

(no exports listed β€” the icon is being mysterious πŸ’…)


πŸŽ€ PACKAGE VARIABLES πŸŽ€

(nothing listed here either β€” sometimes the absence IS the statement ✨)


πŸ”₯ FUNCTIONS πŸ”₯

πŸ’œ initialize_unit

Perform the boilerplate tasks that have to be done at the beginning of every unit. Yes, every unit. No skipping, no cap. 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

Both of them optional, bestie, so if you roll up with an empty hash it's not gonna be weird about it. πŸ’…


🌈 status_from_json

okay so 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 β€” it takes a JSON string and converts it back into a status object. It's giving "un-baking the cake" energy and honestly? Obsessed. πŸŽ€

⚠️ FIXME: There may be some encoding issues here! Not me pretending everything is fine 😭 the original authors said it, not me.

πŸ¦‹ req

Assemble and process a HTTP request. The main character of this module, fr fr. 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. So bestie, check that code before you start celebrating. πŸ”₯


⭐ llreq

Low-level request generator. That's the whole description. Minimal. Mysterious. Lowkey iconic. ✨


πŸ’€ docu_check

Check that the resource has on-line documentation (takes Plack::Test object and resource name without quotes). Yes, without quotes β€” I said what I said, don't @ me. πŸ™ˆ


and that's the page, bestie 🫢

this whole thing is from perl v5.40.1, dated 2025-06-21 β€” so it's recent, it's fresh, it's serving. slay, go write some tests. πŸ’…βœ¨

πŸ“¦ where this page comes from