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