From dfc361813c6a7412d70b8782e29e712b4f06bba2 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Thu, 5 Apr 2018 17:53:51 +0100 Subject: admin UI to configure fetch_all_problems Open311 option UI to update the fetch_all_problems setting in extra for a body. This also adds handling for extra body values in the Admin in a similar manner to the way other body params are handled. --- t/app/controller/admin/bodies.t | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 't/app/controller/admin') diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t index 9bdf8fb9a..a485d286d 100644 --- a/t/app/controller/admin/bodies.t +++ b/t/app/controller/admin/bodies.t @@ -150,6 +150,45 @@ subtest 'check open311 configuring' => sub { is $conf->endpoint, 'http://example.org/open311', 'endpoint updated'; is $conf->api_key, 'new api key', 'api key updated'; is $conf->jurisdiction, 'open311', 'jurisdiction configures'; + ok !$conf->get_extra_metadata('fetch_all_problems'), 'fetch all problems unset'; + + $mech->form_number(3); + $mech->submit_form_ok( + { + with_fields => { + api_key => 'new api key', + endpoint => 'http://example.org/open311', + jurisdiction => 'open311', + send_comments => 0, + send_method => 'Open311', + fetch_all_problems => 1, + } + } + ); + + $mech->content_contains('Values updated'); + + $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); + ok $conf->get_extra_metadata('fetch_all_problems'), 'fetch all problems set'; + + $mech->form_number(3); + $mech->submit_form_ok( + { + with_fields => { + api_key => 'new api key', + endpoint => 'http://example.org/open311', + jurisdiction => 'open311', + send_comments => 0, + send_method => 'Open311', + fetch_all_problems => 0, + } + } + ); + + $mech->content_contains('Values updated'); + + $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); + ok !$conf->get_extra_metadata('fetch_all_problems'), 'fetch all problems unset'; }; subtest 'check text output' => sub { -- cgit v1.2.3