aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/around.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-10-23 17:01:40 +0100
committerStruan Donald <struan@exo.org.uk>2018-11-12 11:24:09 +0000
commit9e9460b8ff4bdccf9dc0166331688f2f0818b29f (patch)
tree4d07226516cfc61782d12a4f76480fb559509a88 /t/app/controller/around.t
parent6c2fa7f8e55283d1595ac7f293de5266f2b8fed7 (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/around.t')
-rw-r--r--t/app/controller/around.t51
1 files changed, 48 insertions, 3 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
index 8eeafec7f..18281396a 100644
--- a/t/app/controller/around.t
+++ b/t/app/controller/around.t
@@ -104,7 +104,10 @@ foreach my $test (
};
}
-my @edinburgh_problems = $mech->create_problems_for_body( 5, 2651, 'Around page', {
+my $body_edin_id = $mech->create_body_ok(2651, 'City of Edinburgh Council')->id;
+my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id;
+
+my @edinburgh_problems = $mech->create_problems_for_body( 5, $body_edin_id, 'Around page', {
postcode => 'EH1 1BB',
latitude => 55.9519637512,
longitude => -3.17492254484,
@@ -128,7 +131,7 @@ subtest 'check non public reports are not displayed on around page' => sub {
$mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } },
"good location" );
};
- $mech->content_contains( 'Around page Test 3 for 2651',
+ $mech->content_contains( "Around page Test 3 for $body_edin_id",
'problem to be marked non public visible' );
my $private = $edinburgh_problems[2];
@@ -142,10 +145,52 @@ subtest 'check non public reports are not displayed on around page' => sub {
$mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } },
"good location" );
};
- $mech->content_lacks( 'Around page Test 3 for 2651',
+ $mech->content_lacks( "Around page Test 3 for $body_edin_id",
'problem marked non public is not visible' );
};
+for my $permission ( qw/ report_inspect report_mark_private/ ) {
+ subtest 'check non public reports are displayed on around page with $permission permission' => sub {
+ my $body = FixMyStreet::DB->resultset('Body')->find( $body_edin_id );
+ my $body2 = FixMyStreet::DB->resultset('Body')->find( $body_west_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,
+ });
+
+ $mech->get_ok('/');
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } },
+ "good location" );
+ };
+ $mech->content_contains( "Around page Test 3 for $body_edin_id",
+ 'problem marked non public is visible' );
+
+ $user->user_body_permissions->delete();
+ $user->update({ from_body => $body2 });
+ $user->user_body_permissions->find_or_create({
+ body => $body2,
+ permission_type => $permission,
+ });
+
+ $mech->get_ok('/');
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } },
+ "good location" );
+ };
+ $mech->content_lacks( "Around page Test 3 for $body_edin_id",
+ 'problem marked non public is not visible' );
+ };
+}
my $body = $mech->create_body_ok(2237, "Oxfordshire");