diff options
author | Struan Donald <struan@exo.org.uk> | 2018-10-23 17:01:40 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-11-12 11:24:09 +0000 |
commit | 9e9460b8ff4bdccf9dc0166331688f2f0818b29f (patch) | |
tree | 4d07226516cfc61782d12a4f76480fb559509a88 /t/app/controller/reports.t | |
parent | 6c2fa7f8e55283d1595ac7f293de5266f2b8fed7 (diff) |
add report_mark_private permission
Allows user's to see the inspector panel to mark reports as Private, and
also to view those non-public reports. Useful for call centre staff who
want to record private reports but don't need to other permissions.
Fixes mysociety/fixmystreet-commercial#1213
Diffstat (limited to 't/app/controller/reports.t')
-rw-r--r-- | t/app/controller/reports.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 66af2778d..3ba90c062 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -215,6 +215,47 @@ is scalar @$problems, 4, 'only public problems are displayed'; $mech->content_lacks('All reports Test 3 for ' . $body_west_id, 'non public problem is not visible'); +for my $permission( qw/ report_inspect report_mark_private / ) { + subtest "user with $permission permission can see non public reports" => sub { + my $body = FixMyStreet::DB->resultset('Body')->find( $body_west_id ); + my $body2 = FixMyStreet::DB->resultset('Body')->find( $body_edin_id ); + my $user = $mech->log_in_ok( 'test@example.com' ); + $user->user_body_permissions->delete(); + $user->update({ from_body => $body }); + $user->user_body_permissions->find_or_create({ + body => $body, + permission_type => $permission, + }); + + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/reports/Westminster'); + }; + $problems = $mech->extract_problem_list; + is scalar @$problems, 5, 'only public problems are displayed'; + + $mech->content_contains('All reports Test 3 for ' . $body_west_id, 'non public problem is visible'); + + $user->user_body_permissions->delete(); + $user->update({ from_body => $body2 }); + $user->user_body_permissions->find_or_create({ + body => $body2, + permission_type => $permission, + }); + + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/reports/Westminster'); + }; + $problems = $mech->extract_problem_list; + is scalar @$problems, 4, 'only public problems are displayed'; + + $mech->content_lacks('All reports Test 3 for ' . $body_west_id, 'non public problem is not visible'); + }; +} + # No change to numbers if report is non-public FixMyStreet::override_config { TEST_DASHBOARD_DATA => $data, |