diff options
author | Struan Donald <struan@exo.org.uk> | 2011-11-18 14:31:22 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-11-18 14:31:22 +0000 |
commit | 44091a00e14828f4fff918f9dbdfadef4c04ec11 (patch) | |
tree | 2df2773021b5aac933f72a88be73ef879e5851dc /t | |
parent | 6fcada7050449a2181a73fda444b2f2c7ec94236 (diff) |
more verbose error messages for open311
Diffstat (limited to 't')
-rw-r--r-- | t/open311.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/open311.t b/t/open311.t index f7a8cd815..ce4330b9c 100644 --- a/t/open311.t +++ b/t/open311.t @@ -2,7 +2,9 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More; +use Test::Warn; +use FixMyStreet::App; use FindBin; use lib "$FindBin::Bin/../perllib"; @@ -21,4 +23,20 @@ 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'; +my $o2 = Open311->new( endpoint => 'http://192.168.50.1/open311/', jurisdiction => 'example.org' ); +my $u = FixMyStreet::App->model('DB::User')->new( { email => 'test@example.org', name => 'A User' } ); + +my $p = FixMyStreet::App->model('DB::Problem')->new( { + latitude => 1, + longitude => 1, + title => 'title', + detail => 'detail', + user => $u, +} ); + +my $expected_error = qr{.*request failed: 500 Can.t connect to 192.168.50.1:80 \(Operation timed out\).*}; + +warning_like {$o2->send_service_request( $p, { url => 'http://example.com/' }, 1 )} $expected_error, 'warning generated on failed call'; + +done_testing(); |