{"id":18402707,"url":"https://github.com/jasei/test-restapi","last_synced_at":"2025-04-12T18:29:33.717Z","repository":{"id":56832718,"uuid":"70163929","full_name":"JaSei/Test-RestAPI","owner":"JaSei","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-04T14:03:53.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T03:44:38.276Z","etag":null,"topics":["module","perl","perl5","restapi","test-framework"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Test::RestAPI","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaSei.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-06T14:52:22.000Z","updated_at":"2017-06-16T08:28:27.000Z","dependencies_parsed_at":"2022-09-08T05:10:59.745Z","dependency_job_id":null,"html_url":"https://github.com/JaSei/Test-RestAPI","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaSei%2FTest-RestAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaSei%2FTest-RestAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaSei%2FTest-RestAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaSei%2FTest-RestAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaSei","download_url":"https://codeload.github.com/JaSei/Test-RestAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248612783,"owners_count":21133378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["module","perl","perl5","restapi","test-framework"],"created_at":"2024-11-06T02:43:15.007Z","updated_at":"2025-04-12T18:29:33.692Z","avatar_url":"https://github.com/JaSei.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nTest::RestAPI - Real mock of REST API\n\n# SYNOPSIS\n\n    my $api = Test::RestAPI-\u003enew(\n        endpoints =\u003e [\n            Test::RestAPI::Endpoint-\u003enew(\n                path =\u003e '/a',\n                method   =\u003e 'any',\n            )\n        ],\n    );\n\n    $api-\u003estart();\n\n    HTTP::Tiny-\u003enew-\u003eget($api-\u003euri.'/test');\n\n# DESCRIPTION\n\nIn many (test) case you need mock some REST API. One way is mock your REST-API class abstraction or HTTP client.\nThis module provides other way - start generated [Mojolicious](https://metacpan.org/pod/Mojolicious) server and provides pseudo-real your defined API.\n\n# METHODS\n\n## new(%attribute)\n\n### %attribute\n\n#### endpoints\n\n_ArrayRef_ of instances [Test::RestAPI::Endpoint](https://metacpan.org/pod/Test::RestAPI::Endpoint)\n\ndefault is _/_ (root) 200 OK - hello:\n\n    Test::RestAPI::Endpoint-\u003enew(\n        path   =\u003e '/',\n        method =\u003e 'any',\n        render =\u003e {text =\u003e 'Hello'},\n    );\n\n#### mojo\\_app\\_generator\n\nThis attribute is used for generating mojo application.\n\ndefault is [Test::RestAPI::MojoGenerator](https://metacpan.org/pod/Test::RestAPI::MojoGenerator)\n\n### start\n\nStart REST API ([Mojolicious](https://metacpan.org/pod/Mojolicious)) application on some random unused port\nand wait to initialize.\n\nFor start new process is used `fork-exec` on non-windows machines and [Win32::Process](https://metacpan.org/pod/Win32::Process) for windows machines.\n\nFor generating [Mojolicious](https://metacpan.org/pod/Mojolicious) application is used [Test::RestAPI::MojoGenerator](https://metacpan.org/pod/Test::RestAPI::MojoGenerator) in `mojo_app_generator` attribute - is possible set own generator.\n\n## count\\_of\\_requests($path)\n\nreturn count of request to `$path` endpoint\n\n## list\\_of\\_requests\\_body($path)\n\nreturn list (ArrayRef) of requests body to `$path` endpoint\n\n# LICENSE\n\nCopyright (C) Avast Software.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nJan Seidl \u003cseidl@avast.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasei%2Ftest-restapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasei%2Ftest-restapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasei%2Ftest-restapi/lists"}