aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
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.t26
3 files changed, 29 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..daa213e8c 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',
@@ -119,6 +133,18 @@ subtest "Body user, has permission to add update as another (existing) user" =>
like $mech->get_text_body_from_email, qr/Your update has been logged/;
};
+subtest "Body user, has permission to add update as anonymous user" => sub {
+ my $update = add_update(
+ 'contribute_as_anonymous_user',
+ form_as => 'anonymous_user',
+ update => 'Test Update',
+ );
+ is $update->name, 'Oxfordshire County Council', 'update name is body';
+ is $update->user->name, 'Body User', 'user name unchanged';
+ is $update->user->id, $user->id, 'user matches';
+ is $update->anonymous, 1, 'update anonymous';
+};
+
done_testing();
sub start_report {