X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_app.t;h=31ea9b7facfb5e156d81a41c3ba6560d19546408;hb=ac92fd52e650f58ec34dfb078551854880b73d2e;hp=519bf0cd855c6a690514422ac41445e7ff128350;hpb=a14203f823c2d4c90975bc55cb90b203d9577934;p=catagits%2FCatalyst-Authentication-Credential-HTTP.git diff --git a/t/live_app.t b/t/live_app.t index 519bf0c..31ea9b7 100644 --- a/t/live_app.t +++ b/t/live_app.t @@ -1,60 +1,41 @@ #!/usr/bin/perl - use strict; use warnings; - use Test::More; - BEGIN { eval { require Test::WWW::Mechanize::Catalyst } or plan skip_all => "Test::WWW::Mechanize::Catalyst is needed for this test"; plan tests => 4; } - use HTTP::Request; - { - package AuthTestApp; use Catalyst qw/ Authentication Authentication::Store::Minimal Authentication::Credential::HTTP /; - use Test::More; - our $users; - sub moose : Local { my ( $self, $c ) = @_; - $c->authorization_required; - $c->res->body( $c->user->id ); } __PACKAGE__->config->{authentication}{http}{type} = 'basic'; __PACKAGE__->config->{authentication}{users} = $users = { foo => { password => "s3cr3t", }, }; - __PACKAGE__->setup; } - use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/; - my $mech = Test::WWW::Mechanize::Catalyst->new; - $mech->get("http://localhost/moose"); is( $mech->status, 401, "status is 401" ); - $mech->content_lacks( "foo", "no output" ); - my $r = HTTP::Request->new( GET => "http://localhost/moose" ); $r->authorization_basic(qw/foo s3cr3t/); - $mech->request($r); is( $mech->status, 200, "status is 200" ); $mech->content_contains( "foo", "foo output" ); -