Commit | Line | Data |
790f9ddb |
1 | #!/usr/bin/perl |
790f9ddb |
2 | use strict; |
3 | use warnings; |
ed61ff6d |
4 | use Test::More; |
ed61ff6d |
5 | BEGIN { |
6 | eval { require Test::WWW::Mechanize::Catalyst } |
7 | or plan skip_all => |
8 | "Test::WWW::Mechanize::Catalyst is needed for this test"; |
9 | plan tests => 4; |
10 | } |
790f9ddb |
11 | use HTTP::Request; |
861c2f44 |
12 | |
13 | use Test::More; |
790f9ddb |
14 | use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/; |
790f9ddb |
15 | my $mech = Test::WWW::Mechanize::Catalyst->new; |
790f9ddb |
16 | $mech->get("http://localhost/moose"); |
513d8ab6 |
17 | is( $mech->status, 401, "status is 401" ) or die $mech->content; |
ed61ff6d |
18 | $mech->content_lacks( "foo", "no output" ); |
790f9ddb |
19 | my $r = HTTP::Request->new( GET => "http://localhost/moose" ); |
20 | $r->authorization_basic(qw/foo s3cr3t/); |
ed61ff6d |
21 | $mech->request($r); |
22 | is( $mech->status, 200, "status is 200" ); |
23 | $mech->content_contains( "foo", "foo output" ); |
513d8ab6 |
24 | |