From db8898037b67265b18ffac9ef8b6696dc6d33d22 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 5 Feb 2018 22:24:22 +0000 Subject: Add admin ability to log user out. --- t/app/controller/admin/users.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't/app/controller/admin') diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t index e6cf51449..187652b3c 100644 --- a/t/app/controller/admin/users.t +++ b/t/app/controller/admin/users.t @@ -410,4 +410,14 @@ subtest "Hiding user's reports from admin" => sub { is $c, $count_u; }; +subtest "Logging user out" => sub { + my $mech2 = FixMyStreet::TestMech->new; + $mech2->log_in_ok($user->email); + $mech2->logged_in_ok; + + $mech->get_ok( '/admin/user_edit/' . $user->id ); + $mech->submit_form_ok({ button => 'logout_everywhere' }, 'Logging user out'); + $mech2->not_logged_in_ok; +}; + done_testing(); -- cgit v1.2.3 From d126f95249a0a7b0b0c3289b597a7b89e13a2fbb Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 31 Jan 2018 16:15:44 +0000 Subject: Admin ability to remove user account details. --- t/app/controller/admin/users.t | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't/app/controller/admin') diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t index 187652b3c..63295e26d 100644 --- a/t/app/controller/admin/users.t +++ b/t/app/controller/admin/users.t @@ -420,4 +420,20 @@ subtest "Logging user out" => sub { $mech2->not_logged_in_ok; }; +subtest "Removing account from admin" => sub { + $mech->create_problems_for_body(4, 2237, 'Title'); + 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 => 'remove_account' }, 'Removing account'); + my $c = FixMyStreet::DB->resultset('Problem')->search({ user_id => $user->id, anonymous => 1, name => '' })->count; + is $c, $count_p, 'All reports anon/nameless'; + $c = FixMyStreet::DB->resultset('Comment')->search({ user_id => $user->id, anonymous => 1, name => '' })->count; + is $c, $count_u, 'All updates anon/nameless'; + $user->discard_changes; + is $user->name, '', 'Name gone'; + is $user->password, '', 'Password gone'; + is $user->email, 'removed-' . $user->id . '@example.org', 'Email gone' +}; + done_testing(); -- cgit v1.2.3