aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2020-02-04 15:38:24 +0000
committerDave Arter <davea@mysociety.org>2020-02-10 09:54:55 +0000
commitb91a0b4ee71c8f8f2bd2c03ae6fff7249303722c (patch)
tree0bf9ef3028f04c4b8f3b7611cb15c48be494499e /t
parent806a1b638539d846eca693f97c63c272360bd361 (diff)
[Zürich] Fix crash on certain /report/ajax/<id> URLs
Attempting to load the /report/ajax/<id> URL for a problem that had a public response and wasn't in the ‘external’ state was causing a crash because the call to FixMyStreet::App::View::Web::add_links in updates_as_hashref was returning a FixMyStreet::Template::SafeString that the JSON module didn't know how to serialise. This commit adds a TO_JSON method to SafeString, and ensures the output of /report/ajax is JSON-encoded with convert_blessed turned on so the TO_JSON method is called.
Diffstat (limited to 't')
-rw-r--r--t/cobrand/zurich.t9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index f2dd754f1..0a144de23 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -118,6 +118,15 @@ my $json = $mech->get_ok_json( '/report/ajax/' . $report->id );
is $json->{report}->{title}, "Überprüfung ausstehend", "correct title";
is $json->{report}->{state}, "submitted", "correct state";
+$report->state('fixed - council');
+$report->set_extra_metadata(public_response => 'Freundliche Grüsse');
+$report->update;
+$json = $mech->get_ok_json( '/report/ajax/' . $report->id );
+is $json->{report}->{state}, "closed", "correct state";
+is $json->{updates}->{details}, "Freundliche Grüsse", "correct public response";
+
+$report->update({ state => 'submitted' });
+
subtest "Banners are displayed correctly" => sub {
for my $test (
{