6 eval { require Test::WWW::Mechanize::Catalyst }
8 "Test::WWW::Mechanize::Catalyst is needed for this test";
19 __PACKAGE__->config(authentication => {
20 default_realm => 'test',
30 password_type => 'clear',
31 password_field => 'password'
41 my ( $self, $c ) = @_;
42 $c->res->body( $c->user->id );
45 foo => { password => "s3cr3t", },
49 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
50 my $mech = Test::WWW::Mechanize::Catalyst->new;
51 $mech->get("http://localhost/moose");
52 is( $mech->status, 401, "status is 401" ) or die $mech->content;
53 $mech->content_lacks( "foo", "no output" );
54 my $r = HTTP::Request->new( GET => "http://localhost/moose" );
55 $r->authorization_basic(qw/foo s3cr3t/);
57 is( $mech->status, 200, "status is 200" );
58 $mech->content_contains( "foo", "foo output" );