aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-08-09 16:46:39 +0100
committerStruan Donald <struan@exo.org.uk>2017-08-16 10:42:23 +0100
commitf066a3937216e0cc4dc0413efc8e8f90e79b6066 (patch)
tree46b9dd9d5c71b3ba8b44358e5a2864b33b24f6a1 /t
parent60b941bc7868c4b0a829f7d497262015d6ab69c4 (diff)
enable body users to report problems anonymously
uses the body user but flags the report as anonymous Fixes #fixmystreetforcouncils/207
Diffstat (limited to 't')
-rw-r--r--t/app/controller/admin.t1
-rw-r--r--t/app/controller/admin_permissions.t2
-rw-r--r--t/app/controller/report_as_other.t14
3 files changed, 17 insertions, 0 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 069e00b5e..075ab0fd0 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -1177,6 +1177,7 @@ my %default_perms = (
"permissions[report_inspect]" => undef,
"permissions[report_instruct]" => undef,
"permissions[contribute_as_another_user]" => undef,
+ "permissions[contribute_as_anonymous_user]" => undef,
"permissions[contribute_as_body]" => undef,
"permissions[view_body_contribute_details]" => undef,
"permissions[user_edit]" => undef,
diff --git a/t/app/controller/admin_permissions.t b/t/app/controller/admin_permissions.t
index 0997e1e38..7944cc0b1 100644
--- a/t/app/controller/admin_permissions.t
+++ b/t/app/controller/admin_permissions.t
@@ -146,6 +146,7 @@ FixMyStreet::override_config {
"permissions[report_inspect]" => undef,
"permissions[report_instruct]" => undef,
"permissions[contribute_as_another_user]" => undef,
+ "permissions[contribute_as_anonymous_user]" => undef,
"permissions[contribute_as_body]" => undef,
"permissions[user_edit]" => undef,
"permissions[user_manage_permissions]" => undef,
@@ -178,6 +179,7 @@ FixMyStreet::override_config {
"permissions[report_inspect]" => undef,
"permissions[report_instruct]" => undef,
"permissions[contribute_as_another_user]" => undef,
+ "permissions[contribute_as_anonymous_user]" => undef,
"permissions[contribute_as_body]" => undef,
"permissions[user_edit]" => undef,
"permissions[user_manage_permissions]" => undef,
diff --git a/t/app/controller/report_as_other.t b/t/app/controller/report_as_other.t
index 86c2deb93..326b3c906 100644
--- a/t/app/controller/report_as_other.t
+++ b/t/app/controller/report_as_other.t
@@ -76,6 +76,20 @@ subtest "Body user, has permission to add report as another (existing) user" =>
push @users, $report->user;
};
+subtest "Body user, has permission to add report as anonymous user" => sub {
+ my $report = add_report(
+ 'contribute_as_anonymous_user',
+ form_as => 'anonymous_user',
+ title => "Test Report",
+ detail => 'Test report details.',
+ category => 'Street lighting',
+ );
+ is $report->name, 'Oxfordshire County Council', 'report name is body';
+ is $report->user->name, 'Body User', 'user name unchanged';
+ is $report->user->id, $user->id, 'user matches';
+ is $report->anonymous, 1, 'report anonymous';
+};
+
subtest "Body user, has permission to add update as council" => sub {
my $update = add_update(
'contribute_as_body',