Test::PlugAuth - minimum PlugAuth server to test Clustericious apps against
version 0.38
assuming you have a Clustericious app MyApp with authentication/authorization directives that you need to test:
use Test::Clustericious::Config; use Test::Clustericious; use Test::PlugAuth; my $auth = Test::PlugAuth->new(auth => { my($user,$pass) = @_; return $user eq 'gooduser' && $pass eq 'goodpass'; }); create_config_ok 'MyApp', { plug_auth => { url => $auth->url } }; $t = Test::Clustericious->new('MyApp'); $auth->apply_to_client_app($t->app); my $port = $t->ua->app_url->port; $t->get_ok("http://baduser:badpass\@localhost:$port/private") ->status_is(401); $t->get_ok("http://gooduser:goodpass\@localhost:$port/private") ->status_is(200);
Provides a way to test a Clustericious application with a fake PlugAuth server with reduced boilerplate
Creates a new instance of Test::PlugAuth. The $config is passed directly into PlugAuth::Lite. See Mojolicious::Plugin::PlugAuthLite for details.
The Mojo::UserAgent used to connect to the PlugAuth (lite) server.
The PlugAuth::Lite instance of the PlugAuth server.
The (fake) url used to connect to the PlugAuth server with. You MUST connect to through the Mojo::UserAgent above.
Given a Clustericious application $client_app, this method will rewire our Mojo::UserAgent for authentication requests to PlugAuth.
$client_app
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2013 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::Clustericious::Cluster, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Clustericious::Cluster
CPAN shell
perl -MCPAN -e shell install Test::Clustericious::Cluster
For more information on module installation, please visit the detailed CPAN module installation guide.