diff options
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/admin/users.t | 1 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 34 | ||||
-rw-r--r-- | t/app/sendreport/inspection_required.t | 85 |
3 files changed, 0 insertions, 120 deletions
diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t index 7361ab619..17256a214 100644 --- a/t/app/controller/admin/users.t +++ b/t/app/controller/admin/users.t @@ -249,7 +249,6 @@ my %default_perms = ( "permissions[template_edit]" => undef, "permissions[responsepriority_edit]" => undef, "permissions[category_edit]" => undef, - trusted_bodies => undef, ); # Start this section with user having no name diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index b6498e840..61fa821b2 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -132,7 +132,6 @@ FixMyStreet::override_config { $user->user_body_permissions->create({ body => $oxon, permission_type => 'planned_reports' }); $report->state('confirmed'); $report->update; - my $reputation = $report->user->get_extra_metadata("reputation"); $mech->get_ok("/report/$report_id"); $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", include_update => "1", @@ -145,7 +144,6 @@ FixMyStreet::override_config { $report->discard_changes; my $comment = ($report->comments( undef, { order_by => { -desc => 'id' } } )->all)[1]->text; is $comment, "This is a public update.", 'Update was created'; - is $report->user->get_extra_metadata('reputation'), $reputation, "User reputation wasn't changed"; $mech->get_ok("/report/$report_id"); my $meta = $mech->extract_update_metas; like $meta->[0], qr/State changed to: Action scheduled/, 'First update mentions action scheduled'; @@ -583,38 +581,6 @@ FixMyStreet::override_config { return $perms; }); - subtest "test negative reputation" => sub { - my $reputation = $report->user->get_extra_metadata("reputation") || 0; - - $mech->get_ok("/report/$report_id"); - $mech->submit_form( button => 'remove_from_site' ); - - $report->discard_changes; - is $report->user->get_extra_metadata('reputation'), $reputation-1, "User reputation was decreased"; - $report->update({ state => 'confirmed' }); - }; - - subtest "test positive reputation" => sub { - $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' }); - $report->update; - $report->inspection_log_entry->delete if $report->inspection_log_entry; - my $reputation = $report->user->get_extra_metadata("reputation") || 0; - $mech->get_ok("/report/$report_id"); - $mech->submit_form_ok({ button => 'save', with_fields => { - state => 'in progress', include_update => undef, - } }); - $report->discard_changes; - - $mech->submit_form_ok({ button => 'save', with_fields => { - state => 'action scheduled', include_update => undef, - } }); - $report->discard_changes; - is $report->user->get_extra_metadata('reputation'), $reputation+1, "User reputation was increased"; - - $mech->submit_form_ok({ button => 'save', with_fields => { - state => 'action scheduled', include_update => undef, - } }); - }; subtest "Oxfordshire-specific traffic management options are shown" => sub { $report->update({ state => 'confirmed' }); 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(); |