Web::MREST::Test(3pm)
π 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
- ubuntu resolute: libweb-mrest-perl 0.290-2 Β· BSD-3-Clause
- ubuntu stonking: libweb-mrest-perl 0.290-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms