142c40678a557509d92e13f1aceac4eb19d80ee7
[catagits/Catalyst-Authentication-Credential-HTTP.git] / t / live_app.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use FindBin qw/$Bin/;
6 use lib "$Bin/lib";
7
8 use Test::More;
9 BEGIN {
10     eval { require Test::WWW::Mechanize::Catalyst }
11       or plan skip_all =>
12       "Test::WWW::Mechanize::Catalyst is needed for this test";
13     plan tests => 4;
14 }
15 use HTTP::Request;
16
17 use Test::More;
18 use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
19 my $mech = Test::WWW::Mechanize::Catalyst->new;
20 $mech->get("http://localhost/moose");
21 is( $mech->status, 401, "status is 401" ) or die $mech->content;
22 $mech->content_lacks( "foo", "no output" );
23 my $r = HTTP::Request->new( GET => "http://localhost/moose" );
24 $r->authorization_basic(qw/foo s3cr3t/);
25 $mech->request($r);
26 is( $mech->status, 200, "status is 200" );
27 $mech->content_contains( "foo", "foo output" );
28