aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-07-19 15:18:21 +0100
committerStruan Donald <struan@exo.org.uk>2019-07-31 14:44:36 +0100
commitd43dcaeccd714926c7dd9d00c554d16d179c21ab (patch)
tree98b540a9d08f8f113748b70b71cd703c5c81cc66 /t
parent924a9f155140e511a88f21a6cd0116a93fe08176 (diff)
[open311] unset the external_status_code if blank
If an update with a blank external_status_code is fetched then unset it otherwise we will always a detect a change in the external_status_code which might mean phantom updates.
Diffstat (limited to 't')
-rw-r--r--t/open311/getservicerequestupdates.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index d58855122..809fd3a19 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -874,6 +874,36 @@ subtest 'check that external_status_code is stored correctly' => sub {
is $problem->get_extra_metadata('external_status_code'), "101", "correct external status code";
+ $requests_xml = qq{<?xml version="1.0" encoding="utf-8"?>
+ <service_requests_updates>
+ <request_update>
+ <update_id>638364</update_id>
+ <service_request_id>@{[ $problem->external_id ]}</service_request_id>
+ <status>open</status>
+ <description>This is a note</description>
+ <updated_datetime>UPDATED_DATETIME</updated_datetime>
+ <external_status_code></external_status_code>
+ </request_update>
+ </service_requests_updates>
+ };
+
+ $problem->comments->delete;
+
+ my $dt3 = $dt->clone->add( minutes => 1 );
+ $requests_xml =~ s/UPDATED_DATETIME/$dt3/;
+
+ $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $requests_xml } );
+
+ $update = Open311::GetServiceRequestUpdates->new(
+ system_user => $user,
+ current_open311 => $o,
+ current_body => $bodies{2482},
+ );
+
+ $update->process_body;
+
+ $problem->discard_changes;
+ is $problem->get_extra_metadata('external_status_code'), '', "external status code unset";
};
subtest 'check that external_status_code triggers auto-responses' => sub {