From: t0m Date: Wed, 8 Jul 2009 20:30:14 +0000 (+0100) Subject: Failing tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-TraitFor-Request-ProxyBase.git;a=commitdiff_plain;h=cbca054ea5f62fbb361b19d6306316f3b262b575 Failing tests --- diff --git a/t/live-test.t b/t/live-test.t index b1f664d..765ef8e 100644 --- a/t/live-test.t +++ b/t/live-test.t @@ -2,7 +2,8 @@ use strict; use warnings; -use Test::More tests => 1; +use HTTP::Request::Common; +use Test::More tests => 9; # setup library path use FindBin qw($Bin); @@ -13,6 +14,26 @@ use TestApp; # a live test against TestApp, the test application use Catalyst::Test 'TestApp'; -my ($res, $c) = ctx_request('/'); -is($c->res->body, 'http://localhost/'); +sub req_with_base { + my $base = shift; + + my ($res, $c) = ctx_request(GET('/')); + return $c; +} + +is(req_with_base('http://localhost/')->res->body, 'http://localhost/'); +is(req_with_base('https://localhost/')->res->body, 'https://localhost/'); +ok req_with_base('https://localhost/')->req->secure; + +is(req_with_base('https://example.com:445/')->res->body, + 'https://example.com:445/'); +is(req_with_base('http://example.com:443/')->res->body, + 'http://example.com:443/'); +is(req_with_base('https://example.com:445/some/path')->res->body, + 'https://example.com:445/some/path/'); +is(req_with_base('https://example.com:445/some/path/')->res->body, + 'https://example.com:445/some/path/'); + +ok req_with_base('https://example.com:80/')->req->secure; +ok !req_with_base('http://example.com:443/')->req->secure;