aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-09-28 16:17:14 +0100
committerStruan Donald <struan@exo.org.uk>2018-09-28 16:17:14 +0100
commitec55469dadd99dd0f20d3d0c3b4202b6b70bb6ab (patch)
tree51f55de54db3c2247ea20b9cb1ede26c88e71b4b
parentc01a986773642a152095b25f1d006ca561e975e0 (diff)
Fix failing inspector tool tests
Adds a mocked Oxfordshire cobrand permissions method that adds back in the permissions explicitly removed there.
-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 33e3b39c3..6e65c1336 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
@@ -506,6 +507,14 @@ foreach my $test (
FixMyStreet::override_config {
ALLOWED_COBRANDS => $test->{cobrand},
}, sub {
+ my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+ $cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ my $perms = FixMyStreet::Cobrand::Default->available_permissions;
+
+ return $perms;
+ });
subtest $test->{desc} => sub {
$user->user_body_permissions->delete;
$user->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' });
@@ -552,6 +561,14 @@ foreach my $test (
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;
+
+ return $perms;
+ });
subtest "test negative reputation" => sub {
my $reputation = $report->user->get_extra_metadata("reputation") || 0;
@@ -701,6 +718,14 @@ FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'oxfordshire', 'fixmystreet' ],
BASE_URL => 'http://fixmystreet.site',
}, sub {
+ my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+ $cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ my $perms = FixMyStreet::Cobrand::Default->available_permissions;
+
+ return $perms;
+ });
subtest "test report not resent when category changes if send_method doesn't change" => sub {
$mech->get_ok("/report/$report3_id");
$mech->submit_form(button => 'save', with_fields => { category => 'Badgers', include_update => undef, });