aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-05-07 15:10:46 +0100
committerStruan Donald <struan@exo.org.uk>2020-05-12 15:36:52 +0100
commitc80f13eeac448e99873b690411d7f6e83b07dd06 (patch)
treeabf43a53330728a1a7a02f462a8173f5e499048c /t/app/controller/admin
parent08f4e0171579f77165ce074e88086d1caeb7a243 (diff)
admin interface for per category anonymous reporting
Add an interface to enable a category to accept anonymous reports, plus the code to handle permitting this. It's only available on single body cobrand sites in the default configuration.
Diffstat (limited to 't/app/controller/admin')
-rw-r--r--t/app/controller/admin/bodies.t34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t
index 9f7b18cde..80ee22630 100644
--- a/t/app/controller/admin/bodies.t
+++ b/t/app/controller/admin/bodies.t
@@ -1,3 +1,13 @@
+package FixMyStreet::Cobrand::AnonAllowedByCategory;
+use parent 'FixMyStreet::Cobrand::UKCouncils';
+sub council_url { 'anonbycategory' }
+sub council_name { 'Aberdeen City Council' }
+sub council_area { 'Aberdeen' }
+sub council_area_id { 2650 }
+sub anonymous_account { { email => 'anoncategory@example.org', name => 'Anonymous Category' } }
+
+package main;
+
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
@@ -295,8 +305,32 @@ subtest 'reopen disabling' => sub {
is $contact->get_extra_metadata('reopening_disallowed'), 1, 'Reopening disallowed flag set';
};
+subtest 'allow anonymous reporting' => sub {
+ $mech->get_ok('/admin/body/' . $body->id . '/test%20category');
+ $mech->content_lacks('Allow anonymous reports');
+};
}; # END of override wrap
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ MAPIT_TYPES => [ 'UTA' ],
+ BASE_URL => 'http://www.example.org',
+ ALLOWED_COBRANDS => [ "fixmystreet", "anonallowedbycategory" ],
+}, sub {
+
+subtest 'allow anonymous reporting' => sub {
+ $mech->get_ok('/admin/body/' . $body->id . '/test%20category');
+ $mech->submit_form_ok( { with_fields => {
+ anonymous_allowed => 1,
+ note => 'Anonymous Allowed',
+ } } );
+ $mech->content_contains('Values updated');
+ my $contact = $body->contacts->find({ category => 'test category' });
+ is $contact->get_extra_metadata('anonymous_allowed'), 1, 'Anonymous reports allowed flag set';
+};
+
+};
+
FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.uk/',