Movatterモバイル変換


[0]ホーム

URL:


 / 
Test-RestAPI-0.1.6
River stage zero No dependents
/Test::RestAPI

NAME

Test::RestAPI - Real mock of REST API

SYNOPSIS

my $api = Test::RestAPI->new(    endpoints => [        Test::RestAPI::Endpoint->new(            path => '/a',            method   => 'any',        )    ],);$api->start();HTTP::Tiny->new->get($api->uri.'/test');

DESCRIPTION

In many (test) case you need mock some REST API. One way is mock your REST-API class abstraction or HTTP client. This module provides other way - start generatedMojolicious server and provides pseudo-real your defined API.

METHODS

new(%attribute)

%attribute

endpoints

ArrayRef of instancesTest::RestAPI::Endpoint

default is/ (root) 200 OK - hello:

Test::RestAPI::Endpoint->new(    path   => '/',    method => 'any',    render => {text => 'Hello'},);

mojo_app_generator

This attribute is used for generating mojo application.

default isTest::RestAPI::MojoGenerator

start

Start REST API (Mojolicious) application on some random unused port and wait to initialize.

For start new process is usedfork-exec on non-windows machines andWin32::Process for windows machines.

For generatingMojolicious application is usedTest::RestAPI::MojoGenerator inmojo_app_generator attribute - is possible set own generator.

count_of_requests($path)

return count of request to$path endpoint

list_of_requests_body($path)

return list (ArrayRef) of requests body to$path endpoint

LICENSE

Copyright (C) Avast Software.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Jan Seidl <seidl@avast.com>

Module Install Instructions

To install Test::RestAPI, copy and paste the appropriate command in to your terminal.

cpanm

cpanm Test::RestAPI

CPAN shell

perl -MCPAN -e shellinstall Test::RestAPI

For more information on module installation, please visitthe detailed CPAN module installation guide.

Keyboard Shortcuts

Global
sFocus search bar
?Bring up this help dialog
GitHub
gpGo to pull requests
gigo to github issues (only if github is preferred repository)
POD
gaGo to author
gcGo to changes
giGo to issues
gdGo to dist
grGo to repository/SCM
gsGo to source
gbGo to file browse
Search terms
module: (e.g.module:Plugin)
distribution: (e.g.distribution:Dancer auth)
author: (e.g.author:SONGMU Redis)
version: (e.g.version:1.00)

[8]ページ先頭

©2009-2025 Movatter.jp