9 eval { require Test::WWW::Mechanize::Catalyst }
11 "Test::WWW::Mechanize::Catalyst is needed for this test";
22 Authentication::Store::Minimal
23 Authentication::Credential::HTTP
31 my ( $self, $c ) = @_;
33 $c->authorization_required;
35 $c->res->body( $c->user->id );
37 __PACKAGE__->config->{authentication}{http}{type} = 'basic';
38 __PACKAGE__->config->{authentication}{users} = $users = {
39 foo => { password => "s3cr3t", },
45 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
47 my $mech = Test::WWW::Mechanize::Catalyst->new;
49 $mech->get("http://localhost/moose");
50 is( $mech->status, 401, "status is 401" );
52 $mech->content_lacks( "foo", "no output" );
54 my $r = HTTP::Request->new( GET => "http://localhost/moose" );
55 $r->authorization_basic(qw/foo s3cr3t/);
58 is( $mech->status, 200, "status is 200" );
59 $mech->content_contains( "foo", "foo output" );