6 eval { require Test::WWW::Mechanize::Catalyst }
8 "Test::WWW::Mechanize::Catalyst is needed for this test";
16 Authentication::Store::Minimal
17 Authentication::Credential::HTTP
22 my ( $self, $c ) = @_;
23 $c->authorization_required;
24 $c->res->body( $c->user->id );
26 __PACKAGE__->config->{authentication}{http}{type} = 'basic';
27 __PACKAGE__->config->{authentication}{users} = $users = {
28 foo => { password => "s3cr3t", },
32 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
33 my $mech = Test::WWW::Mechanize::Catalyst->new;
34 $mech->get("http://localhost/moose");
35 is( $mech->status, 401, "status is 401" );
36 $mech->content_lacks( "foo", "no output" );
37 my $r = HTTP::Request->new( GET => "http://localhost/moose" );
38 $r->authorization_basic(qw/foo s3cr3t/);
40 is( $mech->status, 200, "status is 200" );
41 $mech->content_contains( "foo", "foo output" );