Test::MockHTTP - utility to test LWP usage without actual HTTP requests
use Test::MockHTTP; my $ua; http_test_setup { $ua = $_[0] }; http_cmp( sub { $ua->do_some_http_request() }, [ as_string => re('image1_link=\S+mail\.rambler\.ru'), # these are pairs of method => test againt its return # value ] ); ...
This function takes one coderef argument which gets called with a specially crafted (with mocked methods) LWP::UserAgent instance before each test. All actions should use this UA to be tested.
It takes 4 arguments.
This is the code to test. It gets called.
This is an arrayref of pairs 'method' => 'test against its return value'. It gets passed into Test::Deep::methods to construct a test against HTTP::Request which is provided by LWP.
TAP message, is directly passed to Test::Deep::cmp_deeply.
HTTP::Response instance which is returned as a fake response to HTTP::Request from simple_request() method. Defaults to simple '200 Ok' empty response.
To install Net::FriendFeed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::FriendFeed
CPAN shell
perl -MCPAN -e shell install Net::FriendFeed
For more information on module installation, please visit the detailed CPAN module installation guide.