diff options
author | Struan Donald <struan@exo.org.uk> | 2011-08-02 16:38:35 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-08-02 16:38:35 +0100 |
commit | 149412d1d4f680a5b7186814db0f1886157bb2d0 (patch) | |
tree | 53bdfb5d1792ff0bf002bc0482b5ccd2a23ae33d /t/open311.t | |
parent | 8ac0fceb6c34a626d97eab2a667a18550204aef8 (diff) |
add simple open311 test, add some error checking and reduce repeated code
Diffstat (limited to 't/open311.t')
-rw-r--r-- | t/open311.t | 24 |
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'; + + |