aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-04-11 09:48:49 +0100
committerDave Arter <davea@mysociety.org>2018-04-11 10:25:18 +0100
commit3328c572d4a5fbfd93cc95001273152691e71c50 (patch)
tree29c77106f80fe7b3cfb0f5a7162a06b83f54dc87 /t
parent1c9645f98a1ee93d11df0ac449915390eca2e42c (diff)
Add link to edit current report in admin
I find myself wanting to view the current report in the admin all the time - this commit adds a link to the top of the inspector column that goes right there. Only visible for superusers and staff users with permission to actually view the admin.
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_inspect.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 5447c744e..f2b300e11 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -50,18 +50,36 @@ FixMyStreet::override_config {
$mech->content_lacks('Save changes');
$mech->content_lacks('Priority');
$mech->content_lacks('Traffic management');
+ $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)');
$user->user_body_permissions->create({ body => $oxon, permission_type => 'report_edit_priority' });
$mech->get_ok("/report/$report_id");
$mech->content_contains('Save changes');
$mech->content_contains('Priority');
$mech->content_lacks('Traffic management');
+ $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)');
$user->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' });
$mech->get_ok("/report/$report_id");
$mech->content_contains('Save changes');
$mech->content_contains('Priority');
$mech->content_contains('Traffic management');
+ $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)');
+ };
+
+ subtest "council staff can't see admin report edit link on FMS.com" => sub {
+ my $report_edit_permission = $user->user_body_permissions->create({
+ body => $oxon, permission_type => 'report_edit' });
+ $mech->get_ok("/report/$report_id");
+ $mech->content_lacks('/admin/report_edit/'.$report_id.'">admin</a>)');
+ $report_edit_permission->delete;
+ };
+
+ subtest "superusers can see admin report edit link on FMS.com" => sub {
+ $user->update({is_superuser => 1});
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains('/admin/report_edit/'.$report_id.'">admin</a>)');
+ $user->update({is_superuser => 0});
};
subtest "test basic inspect submission" => sub {
@@ -539,6 +557,13 @@ FixMyStreet::override_config {
is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed';
};
+ subtest "admin link present on inspect page on cobrand" => sub {
+ my $report_edit_permission = $user->user_body_permissions->create({
+ body => $oxon, permission_type => 'report_edit' });
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains('/admin/report_edit/'.$report_id.'">admin</a>)');
+ $report_edit_permission->delete;
+ };
};
FixMyStreet::override_config {