aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-17 17:50:50 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-01-31 11:18:53 +0000
commit7c49ea4a87bb8b98f1c14e28dc4859c05205f9b7 (patch)
treeba947a7f9d542eda2434ad7c29c6a671505a9038 /t
parent736984870d4b1eaf645d2ad3d23058d9abbf4333 (diff)
Admin ability to make user anonymous.
Diffstat (limited to 't')
-rw-r--r--t/app/controller/admin.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 398ce8ea6..bebbb7806 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -1556,6 +1556,18 @@ FixMyStreet::override_config {
};
+subtest "Anonymizing user from admin" => sub {
+ my $user = $mech->create_user_ok('existing@example.com', name => 'Existing User');
+ my $count_p = FixMyStreet::DB->resultset('Problem')->search({ user_id => $user->id })->count;
+ my $count_u = FixMyStreet::DB->resultset('Comment')->search({ user_id => $user->id })->count;
+ $mech->get_ok( '/admin/user_edit/' . $user->id );
+ $mech->submit_form_ok({ button => 'anon_everywhere' });
+ my $c = FixMyStreet::DB->resultset('Problem')->search({ user_id => $user->id, anonymous => 1 })->count;
+ is $c, $count_p;
+ $c = FixMyStreet::DB->resultset('Comment')->search({ user_id => $user->id, anonymous => 1 })->count;
+ is $c, $count_u;
+};
+
subtest "Test setting a report from unconfirmed to something else doesn't cause a front end error" => sub {
$report->update( { confirmed => undef, state => 'unconfirmed', non_public => 0 } );
$mech->get_ok("/admin/report_edit/$report_id");