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 { |
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 | } |
790f9ddb |
15 | use HTTP::Request; |
861c2f44 |
16 | |
17 | use Test::More; |
790f9ddb |
18 | use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/; |
790f9ddb |
19 | my $mech = Test::WWW::Mechanize::Catalyst->new; |
790f9ddb |
20 | $mech->get("http://localhost/moose"); |
513d8ab6 |
21 | is( $mech->status, 401, "status is 401" ) or die $mech->content; |
ed61ff6d |
22 | $mech->content_lacks( "foo", "no output" ); |
790f9ddb |
23 | my $r = HTTP::Request->new( GET => "http://localhost/moose" ); |
24 | $r->authorization_basic(qw/foo s3cr3t/); |
ed61ff6d |
25 | $mech->request($r); |
26 | is( $mech->status, 200, "status is 200" ); |
27 | $mech->content_contains( "foo", "foo output" ); |
513d8ab6 |
28 | |