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