diff options
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/contact.t | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 2cbdbc0da..254522b92 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -1,3 +1,13 @@ +package FixMyStreet::Cobrand::AbuseOnly; + +use base 'FixMyStreet::Cobrand::Default'; + +sub abuse_reports_only { 1; } + +1; + +package main; + use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -469,6 +479,24 @@ for my $test ( }; } +subtest 'check can limit contact to abuse reports' => sub { + FixMyStreet::override_config { + 'ALLOWED_COBRANDS' => [ 'abuseonly' ], + }, sub { + $mech->get( '/contact' ); + is $mech->res->code, 404, 'cannot visit contact page'; + $mech->get_ok( '/contact?id=' . $problem_main->id, 'can visit for abuse report' ); + + my $token = FixMyStreet::App->model("DB::Token")->create({ + scope => 'moderation', + data => { id => $problem_main->id } + }); + + $mech->get_ok( '/contact?m=' . $token->token, 'can visit for moderation complaint' ); + + } +}; + $problem_main->delete; done_testing(); |