aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311/post-service-request-updates.t
diff options
context:
space:
mode:
Diffstat (limited to 't/open311/post-service-request-updates.t')
-rw-r--r--t/open311/post-service-request-updates.t17
1 files changed, 15 insertions, 2 deletions
diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t
index adfd4e3c5..03fcbeae4 100644
--- a/t/open311/post-service-request-updates.t
+++ b/t/open311/post-service-request-updates.t
@@ -1,12 +1,13 @@
#!/usr/bin/env perl
use FixMyStreet::TestMech;
+use Test::Output;
my $mech = FixMyStreet::TestMech->new;
use_ok( 'Open311::PostServiceRequestUpdates' );
-my $o = Open311::PostServiceRequestUpdates->new( site => 'fixmystreet.com' );
+my $o = Open311::PostServiceRequestUpdates->new;
my $params = {
send_method => 'Open311',
@@ -15,7 +16,10 @@ my $params = {
endpoint => 'endpoint',
jurisdiction => 'home',
};
-my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params, send_extended_statuses => 1 });
+my $bromley = $mech->create_body_ok(2482, 'Bromley', { %$params,
+ endpoint => 'www.bromley.gov.uk',
+ send_extended_statuses => 1,
+ can_be_devolved => 1 });
my $oxon = $mech->create_body_ok(2237, 'Oxfordshire', { %$params, id => "5" . $bromley->id });
my $bucks = $mech->create_body_ok(2217, 'Buckinghamshire', $params);
my $lewisham = $mech->create_body_ok(2492, 'Lewisham', $params);
@@ -33,6 +37,7 @@ subtest 'Check Open311 params' => sub {
my %conf = $o->open311_params($bromley);
is_deeply \%conf, {
%$result,
+ endpoint => 'www.bromley.gov.uk',
extended_statuses => 1,
endpoints => { service_request_updates => 'update.xml', update => 'update.xml' },
fixmystreet_body => $bromley,
@@ -130,8 +135,16 @@ subtest 'Oxfordshire gets an ID' => sub {
$o->send;
$c2->discard_changes;
is $c2->send_fail_count, 1, 'Oxfordshire update tried to send, failed';
+ stdout_like { $o->summary_failures } qr/The following updates failed sending/;
};
};
+subtest 'Devolved contact' => sub {
+ $mech->create_contact_ok(body_id => $bromley->id, category => 'Other', email => "OTHER", send_method => 'Open311', endpoint => '/devolved-endpoint/');
+ $c1->update({ send_fail_count => 0 });
+ $o->send;
+ $c1->discard_changes;
+ like $c1->send_fail_reason, qr/devolved-endpoint/, 'Failure message contains correct endpoint';
+};
done_testing();