summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorivan <ivan>2008-06-14 04:14:48 +0000
committerivan <ivan>2008-06-14 04:14:48 +0000
commit97e89d11919d233afc4bbe3a2c7f14a4d116584b (patch)
tree386cb650341759269b7915676b4bc5014d5f6420 /t
initial importSTART
Diffstat (limited to 't')
-rw-r--r--t/00-load.t9
-rw-r--r--t/get-cryptssleay.t41
-rw-r--r--t/get-netssleay.t36
-rw-r--r--t/pod-coverage.t18
-rw-r--r--t/pod.t12
-rw-r--r--t/post-cryptssleay.t41
-rw-r--r--t/post-netssleay.t36
7 files changed, 193 insertions, 0 deletions
diff --git a/t/00-load.t b/t/00-load.t
new file mode 100644
index 0000000..b986555
--- /dev/null
+++ b/t/00-load.t
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Net::HTTPS::Any' );
+}
+
+diag( "Testing Net::HTTPS::Any $Net::HTTPS::Any::VERSION, Perl $], $^X" );
diff --git a/t/get-cryptssleay.t b/t/get-cryptssleay.t
new file mode 100644
index 0000000..2b3babe
--- /dev/null
+++ b/t/get-cryptssleay.t
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+}
+
+plan( tests=>4 );
+
+use_ok 'Net::HTTPS::Any';
+
+#200
+
+my($content, $response, %headers) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/index.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
+
+ok( length($content), 'Received content' );
+
+#404
+
+my($content2, $response2, %headers2) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/notfound.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (OK) response');
+
diff --git a/t/get-netssleay.t b/t/get-netssleay.t
new file mode 100644
index 0000000..9c83a0f
--- /dev/null
+++ b/t/get-netssleay.t
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+plan( tests=>4 );
+
+use_ok 'Net::HTTPS::Any';
+
+#200
+
+my($content, $response, %headers) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/index.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
+
+ok( length($content), 'Received content' );
+
+#404
+
+my($content2, $response2, %headers2) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/notfound.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (OK) response');
+
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
new file mode 100644
index 0000000..fc40a57
--- /dev/null
+++ b/t/pod-coverage.t
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+ if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok();
diff --git a/t/pod.t b/t/pod.t
new file mode 100644
index 0000000..ee8b18a
--- /dev/null
+++ b/t/pod.t
@@ -0,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();
diff --git a/t/post-cryptssleay.t b/t/post-cryptssleay.t
new file mode 100644
index 0000000..2ddda1b
--- /dev/null
+++ b/t/post-cryptssleay.t
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+ $Business::OnlinePayment::HTTPS::skip_NetSSLeay=1;
+}
+
+plan( tests=>4 );
+
+use_ok 'Net::HTTPS::Any';
+
+#200
+
+my($content, $response, %headers) = Net::HTTPS::Any::https_post(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/index.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
+
+ok( length($content), 'Received content' );
+
+#404
+
+my($content2, $response2, %headers2) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/notfound.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (OK) response');
+
diff --git a/t/post-netssleay.t b/t/post-netssleay.t
new file mode 100644
index 0000000..e8cb2fd
--- /dev/null
+++ b/t/post-netssleay.t
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+plan( tests=>4 );
+
+use_ok 'Net::HTTPS::Any';
+
+#200
+
+my($content, $response, %headers) = Net::HTTPS::Any::https_post(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/index.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
+
+ok( length($content), 'Received content' );
+
+#404
+
+my($content2, $response2, %headers2) = Net::HTTPS::Any::https_get(
+ { 'host' => 'secure.sisd.com',
+ 'port' => 443,
+ 'path' => '/freeside/notfound.html',
+ },
+ 'net_https_any_test' => 1,
+);
+
+like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (OK) response');
+