Test::STF::MockServer - Mock STF Server For Testing
use Test::STF::MockSerer; my $server = Test::STF::MockServer->new(); my $lwp = LWP::UserAgent->new; my $bucket = $server->url_for("/bucket"); my $object = $server->url_for("/bucket/path/to/object.txt") $lwp->put($bucket); $lwp->put($object, Content => "Hello, World!"); $lwp->get($object);
Test::STF::MockServer is a simple object that represents a mock STF server for testing.
Test::STF::MockServer
The STF server instance is automatically spawned via Test::TCP and is automatically destroyed when the server object is desroyed.
Test::TCP
new(%args)
Creates a new Test::STF::MockServer instance. %args can be:
%args
Optional object capable of fulfilling STF::Dispatcher::PSGI's specification. If not specified, STF::Dispatcher::Impl::Hash will be used.
Optional list to be passed to Plack::Runner.
url()
Returns a URI object representing the root STF server.
url_for($string)
Returns a URI object representing the given bucket/object.
$uri = $server->url_for("/path/to/bucket");
Daisuke Maki
original idea by tokuhirom (http://blog.64p.org/entry/2012/12/14/193936)
STF (http://github.com/stf-storage/stf)
STF::Dispatcher::PSGI
Copyright (C) 2013 by Daisuke Maki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.
To install Test::STF::MockServer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::STF::MockServer
CPAN shell
perl -MCPAN -e shell install Test::STF::MockServer
For more information on module installation, please visit the detailed CPAN module installation guide.