diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-10-21 16:32:32 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-10-28 17:10:33 +0000 |
commit | 46ce9b46c34096ce13154e2f68caaa1977a7b28d (patch) | |
tree | 8af20af8a1b0711f6535d122b8b2effef509923b /t/app/sendreport | |
parent | 64687c93beffc07d0fcb10459e5a898544bf8aae (diff) |
Remove unused inspection required/reputation code.
Diffstat (limited to 't/app/sendreport')
-rw-r--r-- | t/app/sendreport/inspection_required.t | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t deleted file mode 100644 index 5eff516f5..000000000 --- a/t/app/sendreport/inspection_required.t +++ /dev/null @@ -1,85 +0,0 @@ -use FixMyStreet; -use FixMyStreet::DB; -use FixMyStreet::TestMech; -use FixMyStreet::Script::Reports; - -ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); - -my $user = $mech->create_user_ok( 'user@example.com' ); - -my $body = $mech->create_body_ok( 2237, 'Oxfordshire County Council'); -# $body->update({ send_method => 'Email' }); - -my $contact = $mech->create_contact_ok( - body_id => $body->id, - category => 'Pothole', - email => 'test@example.org', -); -$contact->set_extra_metadata(inspection_required => 1); -$contact->update; - -my @reports = $mech->create_problems_for_body( 1, $body->id, 'Test', { - cobrand => 'oxfordshire', - category => $contact->category, - user => $user, -}); -my $report = $reports[0]; - -subtest "Report isn't sent if uninspected" => sub { - $mech->clear_emails_ok; - - FixMyStreet::Script::Reports::send(); - - $mech->email_count_is( 0 ); - is $report->whensent, undef, "Report hasn't been sent"; -}; - -subtest 'Uninspected report is sent when made by trusted user' => sub { - $mech->clear_emails_ok; - $report->whensent( undef ); - $report->update; - - $user->user_body_permissions->find_or_create({ - body => $body, - permission_type => 'trusted', - }); - ok $user->has_permission_to('trusted', $report->bodies_str_ids), 'User can make trusted reports'; - - FixMyStreet::Script::Reports::send(); - - $report->discard_changes; - $mech->email_count_is( 1 ); - ok $report->whensent, 'Report marked as sent'; -}; - -subtest "Uninspected report isn't sent when user rep is too low" => sub { - $mech->clear_emails_ok; - $report->whensent( undef ); - $report->update; - - $user->user_body_permissions->delete; - $user->set_extra_metadata(reputation => 15); - $user->update; - - $contact->set_extra_metadata(reputation_threshold => 20); - $contact->update; - - FixMyStreet::Script::Reports::send(); - - $report->discard_changes; - $mech->email_count_is( 0 ); - is $report->whensent, undef, "Report hasn't been sent"; -}; - -subtest 'Uninspected report is sent when user rep is high enough' => sub { - $user->set_extra_metadata(reputation => 21); - $user->update; - - FixMyStreet::Script::Reports::send(); - - $report->discard_changes; - $mech->email_count_is( 1 ); - ok $report->whensent, 'Report marked as sent'; -}; - -done_testing(); |