aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-10-12 14:17:05 +0100
committerStruan Donald <struan@exo.org.uk>2018-10-18 10:00:21 +0100
commit5c736b92c25be4beec7799d5f0d07691e44051da (patch)
tree3ed49386a1a04302aab26edc23e49dc1e8992891 /t/app
parent08e335ce05c81db337f3f7623e1e3fe734546ce9 (diff)
allow cobrands to restrict /contact to abuse reports
Add abuse_reports_only cobrand method that prevents the contact form being used unless it's an abuse report.
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/contact.t28
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();