aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/contact.t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2019-04-05 18:49:32 +0100
committerDave Arter <davea@mysociety.org>2019-06-06 11:59:21 +0100
commitff3b747698f577876bff25512ac137c6677ccab7 (patch)
tree8d11c4376cbb2d7a60b79c94fc9827ef3c417d81 /t/app/controller/contact.t
parent1a1be49646218b2217e25e82e6666749f78dc612 (diff)
[Hounslow] Add general enquiries functionality
This functionality allows a cobrand to replace the /contact form with a form that creates hidden reports which are sent via Open311. The form also allows file uploads in addition to photos. This functionality is currently enabled for the Hounslow cobrand and others cobrands can enable it by defining setup_general_enquiries_stash which primarily sets up the appropriate categories and default values for the report.
Diffstat (limited to 't/app/controller/contact.t')
-rw-r--r--t/app/controller/contact.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index 842f27dd5..c74aaa5ff 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -6,6 +6,16 @@ sub abuse_reports_only { 1; }
1;
+package FixMyStreet::Cobrand::GeneralEnquiries;
+
+use base 'FixMyStreet::Cobrand::Default';
+
+sub abuse_reports_only { 1 }
+
+sub setup_general_enquiries_stash { 1 }
+
+1;
+
package main;
use FixMyStreet::TestMech;
@@ -492,6 +502,27 @@ subtest 'check can limit contact to abuse reports' => sub {
}
};
+subtest 'check redirected to correct form for general enquiries cobrand' => sub {
+ FixMyStreet::override_config {
+ 'ALLOWED_COBRANDS' => [ 'generalenquiries' ],
+ }, sub {
+ $mech->get( '/contact' );
+ is $mech->res->code, 200, "got 200 for final destination";
+ is $mech->res->previous->code, 302, "got 302 for redirect";
+ is $mech->uri->path, '/contact/enquiry';
+
+ $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();