diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-10 13:27:17 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-08-09 18:32:03 +0100 |
commit | c7efa9f49a3aa1744fd12d00ba409734ec217b1a (patch) | |
tree | 561cc02bb4cf7f87eaa2c4943b11ea132aaaea15 /t/app/controller/admin.t | |
parent | 4cdf8b0c15052fd06d811137dda52e3bac65028e (diff) |
add a ban email address button
Diffstat (limited to 't/app/controller/admin.t')
-rw-r--r-- | t/app/controller/admin.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 4e2ec82fe..0acaffc8d 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -488,6 +488,27 @@ subtest 'change email to new user' => sub { is $report->user_id, $user3->id, 'user changed to new user'; }; +subtest 'adding email to abuse list from report page' => sub { + my $email = $report->user->email; + + my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + $abuse->delete if $abuse; + + $mech->get_ok( '/admin/report_edit/' . $report->id ); + $mech->content_contains('Ban email address'); + + $mech->click_ok('banuser'); + + $mech->content_contains('Email added to abuse list'); + $mech->content_contains('<small>(Email in abuse table)</small>'); + + $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + ok $abuse, 'entry created in abuse table'; + + $mech->get_ok( '/admin/report_edit/' . $report->id ); + $mech->content_contains('<small>(Email in abuse table)</small>'); +}; + $log_entries->delete; my $update = FixMyStreet::App->model('DB::Comment')->create( @@ -668,6 +689,27 @@ subtest 'editing update email creates new user if required' => sub { is $update->user->id, $user->id, 'update set to new user'; }; +subtest 'adding email to abuse list from update page' => sub { + my $email = $update->user->email; + + my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + $abuse->delete if $abuse; + + $mech->get_ok( '/admin/update_edit/' . $update->id ); + $mech->content_contains('Ban email address'); + + $mech->click_ok('banuser'); + + $mech->content_contains('Email added to abuse list'); + $mech->content_contains('<small>(Email in abuse table)</small>'); + + $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + ok $abuse, 'entry created in abuse table'; + + $mech->get_ok( '/admin/update_edit/' . $update->id ); + $mech->content_contains('<small>(Email in abuse table)</small>'); +}; + subtest 'hiding comment marked as fixed reopens report' => sub { $update->mark_fixed( 1 ); $update->update; |