NAME

Test::STF::MockServer - Mock STF Server For Testing

SYNOPSIS

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);

DESCRIPTION

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.

METHODS

new(%args)

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.

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");

AUTHOR

Daisuke Maki

original idea by tokuhirom (http://blog.64p.org/entry/2012/12/14/193936)

SEE ALSO

STF (http://github.com/stf-storage/stf)

STF::Dispatcher::PSGI

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.