aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller/admin')
-rw-r--r--t/app/controller/admin/defecttypes.t11
-rw-r--r--t/app/controller/admin/permissions.t8
2 files changed, 19 insertions, 0 deletions
diff --git a/t/app/controller/admin/defecttypes.t b/t/app/controller/admin/defecttypes.t
index 1eaab8414..12ae8948c 100644
--- a/t/app/controller/admin/defecttypes.t
+++ b/t/app/controller/admin/defecttypes.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
@@ -26,6 +27,16 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['bromley'], }, sub {
FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
+ my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+ $cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ my $perms = FixMyStreet::Cobrand::Default->available_permissions;
+ $perms->{Bodies}->{defect_type_edit} = "Add/edit defect types";
+
+ return $perms;
+ });
+
my $body = $mech->create_body_ok( 2237, 'Oxfordshire County Council' );
subtest 'check defect types menu available to superusers' => sub {
diff --git a/t/app/controller/admin/permissions.t b/t/app/controller/admin/permissions.t
index e7f85d140..3fc221a63 100644
--- a/t/app/controller/admin/permissions.t
+++ b/t/app/controller/admin/permissions.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
@@ -28,6 +29,13 @@ ok $report, "created test report - $report_id";
$mech->log_in_ok( $oxfordshireuser->email );
+my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+$cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ return FixMyStreet::Cobrand::Default->available_permissions;
+});
+
subtest "Users can't edit report without report_edit permission" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'oxfordshire' ],