- SEE ALSO
- COPYRIGHT AND LICENSE
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.
The STF server instance is automatically spawned via
Test::TCP and is automatically destroyed when the server object is desroyed.
Creates a new Test::STF::MockServer instance.
%args can be:
- impl (Object)
Optional object capable of fulfilling STF::Dispatcher::PSGI's specification. If not specified, STF::Dispatcher::Impl::Hash will be used.
- plack_args (ArrayRef)
Optional list to be passed to Plack::Runner.
Returns a URI object representing the root STF server.
Returns a URI object representing the given bucket/object.
$uri = $server->url_for("/path/to/bucket");
original idea by tokuhirom (http://blog.64p.org/entry/2012/12/14/193936)
COPYRIGHT AND LICENSE
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.