Failing tests
t0m [Wed, 8 Jul 2009 20:30:14 +0000 (21:30 +0100)]
t/live-test.t

index b1f664d..765ef8e 100644 (file)
@@ -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;