diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-05-07 10:13:15 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-05-07 10:13:15 +0100 |
commit | ab0d1dc84b1ed7a1c572e986eda3a4bdc5157d77 (patch) | |
tree | 92f7637a4350d8211d0620a0420ba44724bfefad /t/app/controller | |
parent | 2773c60226b9370fe8ee00f7b205b571bb87c3b5 (diff) | |
parent | 730d25ae7218d731590b322d4f419a7df6d4e4fb (diff) |
Merge branch '2991-updates-on-categories'
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/admin/bodies.t | 11 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 33 |
2 files changed, 32 insertions, 12 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t index c73a90da1..7ec7aed75 100644 --- a/t/app/controller/admin/bodies.t +++ b/t/app/controller/admin/bodies.t @@ -261,6 +261,17 @@ subtest 'open311 protection editing' => sub { is $contact->get_extra_metadata('open311_protect'), 1, 'Open311 protect flag set'; }; +subtest 'updates disabling' => sub { + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); + $mech->submit_form_ok( { with_fields => { + updates_disallowed => 1, + note => 'Disabling updates', + } } ); + $mech->content_contains('Values updated'); + my $contact = $body->contacts->find({ category => 'test category' }); + is $contact->get_extra_metadata('updates_disallowed'), 1, 'Updates disallowed flag set'; +}; + }; # END of override wrap diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 07ee48587..e8ab1cc85 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -22,6 +22,8 @@ my $user2 = $mech->create_user_ok('commenter@example.com', name => 'Commenter'); my $body = $mech->create_body_ok(2504, 'Westminster City Council'); +my $contact = $mech->create_contact_ok( body_id => $body->id, category => 'Other', email => 'other' ); + my $dt = DateTime->new( year => 2011, month => 04, @@ -1893,6 +1895,18 @@ for my $test ( }; } +$mech->log_in_ok( $report->user->email ); + +my %standard_fields = ( + name => $report->user->name, + update => 'update text', + photo1 => '', + photo2 => '', + photo3 => '', + may_show_name => 1, + add_alert => 1, +); + for my $test ( { desc => 'update confirmed without marking as fixed leaves state unchanged', @@ -2094,18 +2108,6 @@ for my $test ( }, ) { subtest $test->{desc} => sub { - $mech->log_in_ok( $report->user->email ); - - my %standard_fields = ( - name => $report->user->name, - update => 'update text', - photo1 => '', - photo2 => '', - photo3 => '', - may_show_name => 1, - add_alert => 1, - ); - my %expected_fields = ( %standard_fields, %{ $test->{expected_form_fields} }, @@ -2178,4 +2180,11 @@ FixMyStreet::override_config { }; }; +subtest 'check disabling of updates per category' => sub { + $contact->set_extra_metadata( updates_disallowed => 1 ); + $contact->update; + $mech->get_ok("/report/$report_id"); + $mech->content_lacks('Provide an update'); +}; + done_testing(); |