aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-08-02 16:38:35 +0100
committerStruan Donald <struan@exo.org.uk>2011-08-02 16:38:35 +0100
commit149412d1d4f680a5b7186814db0f1886157bb2d0 (patch)
tree53bdfb5d1792ff0bf002bc0482b5ccd2a23ae33d /t
parent8ac0fceb6c34a626d97eab2a667a18550204aef8 (diff)
add simple open311 test, add some error checking and reduce repeated code
Diffstat (limited to 't')
-rw-r--r--t/open311.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/open311.t b/t/open311.t
new file mode 100644
index 000000000..f7a8cd815
--- /dev/null
+++ b/t/open311.t
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+use FindBin;
+use lib "$FindBin::Bin/../perllib";
+use lib "$FindBin::Bin/../commonlib/perllib";
+
+use_ok( 'Open311' );
+
+my $o = Open311->new();
+ok $o, 'created object';
+
+my $err_text = <<EOT
+<?xml version="1.0" encoding="utf-8"?><errors><error><code>400</code><description>Service Code cannot be null -- can't proceed with the request.</description></error></errors>
+EOT
+;
+
+is $o->_process_error( $err_text ), "400: Service Code cannot be null -- can't proceed with the request.\n", 'error text parsing';
+is $o->_process_error( '503 - service unavailable' ), 'unknown error', 'error text parsing of bad error';
+
+