diff options
Diffstat (limited to 't')
62 files changed, 44 insertions, 278 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 07759197e..4384123bd 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -18,11 +18,7 @@ $mech->create_contact_ok( body_id => $oxford->id, category => 'Graffiti', email my $bromley = $mech->create_body_ok(2482, 'Bromley Council'); -my $user3 = $mech->create_user_ok('test3@example.com', name => 'Test User 2'); - -if ( $user3 ) { - $mech->delete_user( $user3 ); -} +my $user3; my $dt = DateTime->new( year => 2011, @@ -154,16 +150,6 @@ $mech->content_like(qr{AB\d\d}); $mech->content_contains("http://www.example.org/around"); subtest 'check contact creation' => sub { - my $contact = FixMyStreet::App->model('DB::Contact')->search( - { body_id => $body->id, category => [ 'test category', 'test/category' ] } - ); - $contact->delete_all; - - my $history = FixMyStreet::App->model('DB::ContactsHistory')->search( - { body_id => $body->id, category => [ 'test category', 'test/category' ] } - ); - $history->delete_all; - $mech->get_ok('/admin/body/' . $body->id); $mech->submit_form_ok( { with_fields => { @@ -1542,15 +1528,4 @@ subtest "response priorities can't be viewed across councils" => sub { }; }; -END { - $mech->delete_user( $user ); - $mech->delete_user( $user2 ); - $mech->delete_user( $user3 ); - $mech->delete_user( $superuser ); - $mech->delete_user( 'test4@example.com' ); - $mech->delete_body( $oxfordshire ); - $mech->delete_body( $oxford ); - $mech->delete_body( $bromley ); - $mech->delete_body( $westminster ); - done_testing(); -} +done_testing(); diff --git a/t/app/controller/admin_permissions.t b/t/app/controller/admin_permissions.t index f30777d16..0997e1e38 100644 --- a/t/app/controller/admin_permissions.t +++ b/t/app/controller/admin_permissions.t @@ -11,13 +11,6 @@ my $oxfordshireuser = $mech->create_user_ok('counciluser@example.com', name => ' my $bromley = $mech->create_body_ok(2482, 'Bromley Council'); -END { - $mech->delete_user( $user ); - $mech->delete_user( $user2 ); - $mech->delete_user( $superuser ); - $mech->delete_user( $oxfordshireuser ); -} - my $dt = DateTime->new( year => 2011, month => 04, diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index f7d35f9a0..ddf881f4d 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -1,5 +1,6 @@ use FixMyStreet::TestMech; use FixMyStreet::App; +use FixMyStreet::Script::Alerts; my $mech = FixMyStreet::TestMech->new; @@ -434,7 +435,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { - FixMyStreet::App->model('DB::AlertType')->email_alerts(); + FixMyStreet::Script::Alerts::send(); }; # TODO Note the below will fail if the db has an existing alert that matches $mech->email_count_is(3); diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index d1e313df2..388216a1f 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -6,11 +6,8 @@ my $mech = FixMyStreet::TestMech->new; my $test_email = 'test@example.com'; my $test_email2 = 'test@example.net'; my $test_password = 'foobar'; -$mech->delete_user($test_email); END { - $mech->delete_user($test_email); - $mech->delete_user($test_email2); done_testing(); } diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index 7a82fc813..726d264bd 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -251,6 +251,5 @@ for my $tw_state ( 'refused', 'existing UID', 'no email' ) { }; END { - $mech->delete_problems_for_body('2345'); done_testing(); } diff --git a/t/app/controller/council.t b/t/app/controller/council.t index 11898995a..41398ae61 100644 --- a/t/app/controller/council.t +++ b/t/app/controller/council.t @@ -1,14 +1,9 @@ -use strict; -use warnings; -use Test::More; +use FixMyStreet::Test; - -use Catalyst::Test 'FixMyStreet::App'; use_ok( 'FixMyStreet::App::Controller::Council' ); TODO: { local $TODO = 'need to write some tests for this'; - } done_testing(); diff --git a/t/app/controller/index.t b/t/app/controller/index.t index 654ebfcce..be4da6034 100644 --- a/t/app/controller/index.t +++ b/t/app/controller/index.t @@ -88,7 +88,5 @@ subtest "prefilters /around if user has categories" => sub { }; END { - $mech->delete_problems_for_body( 2651 ); - $mech->delete_body($oxon); done_testing(); } diff --git a/t/app/controller/json.t b/t/app/controller/json.t index f7410dbd0..8ee472f5d 100644 --- a/t/app/controller/json.t +++ b/t/app/controller/json.t @@ -111,6 +111,4 @@ is_deeply # ], "correct response"; -$mech->delete_user($user); - done_testing(); diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t index a4a7f3cb6..9ba1ba3df 100644 --- a/t/app/controller/moderate.t +++ b/t/app/controller/moderate.t @@ -11,9 +11,6 @@ my $body = $mech->create_body_ok( $BROMLEY_ID, 'Bromley Council' ); my $dt = DateTime->now; my $user = $mech->create_user_ok('test-moderation@example.com', name => 'Test User'); -$user->user_body_permissions->delete_all; -$user->discard_changes; - my $user2 = $mech->create_user_ok('test-moderation2@example.com', name => 'Test User 2'); sub create_report { @@ -343,11 +340,4 @@ subtest 'And do it as a superuser' => sub { $mech->content_contains('Moderated by a FixMyStreet administrator'); }; -$update->delete; -$update2->delete; -$report->moderation_original_data->delete; -$report->delete; -$report2->delete; -$mech->delete_user($user); - done_testing(); diff --git a/t/app/controller/my.t b/t/app/controller/my.t index 47539ba55..8b4a25c26 100644 --- a/t/app/controller/my.t +++ b/t/app/controller/my.t @@ -63,8 +63,3 @@ is $problems[2]->discard_changes->anonymous, 1, 'Other user problem made anonymo is $update[0]->discard_changes->anonymous, 1, 'User update made anonymous'; done_testing(); - -END { - $mech->delete_user($user); - $mech->delete_user($other_user); -} diff --git a/t/app/controller/my_planned.t b/t/app/controller/my_planned.t index 9e9ac06a2..51ea0297e 100644 --- a/t/app/controller/my_planned.t +++ b/t/app/controller/my_planned.t @@ -78,7 +78,3 @@ subtest "POSTing multiple problems to my/planned/change adds all to shortlist" = }; done_testing(); - -END { - $mech->delete_user($user); -} diff --git a/t/app/controller/page_not_found.t b/t/app/controller/page_not_found.t index 3c2bc3c3d..30a24df09 100644 --- a/t/app/controller/page_not_found.t +++ b/t/app/controller/page_not_found.t @@ -1,11 +1,6 @@ -use strict; -use warnings; +use FixMyStreet::TestMech; -use Test::More tests => 4; - -use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App'; - -my $mech = Test::WWW::Mechanize::Catalyst->new; +my $mech = FixMyStreet::TestMech->new; # homepage ok $mech->get_ok('/'); @@ -16,3 +11,5 @@ my $res = $mech->get($path_to_404); ok !$res->is_success(), "want a bad response"; is $res->code, 404, "got 404"; $mech->content_contains($path_to_404); + +done_testing(); diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index b046cec9b..c6d112df7 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -5,15 +5,6 @@ use FixMyStreet::App::Controller::Questionnaire; ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); -# Make sure there's no outstanding questionnaire emails to be sent -FixMyStreet::App->model('DB::Questionnaire')->send_questionnaires( { - site => 'fixmystreet' -} ); -$mech->clear_emails_ok; - -# create a test user and report -$mech->delete_user('test@example.com'); - my $user = $mech->create_user_ok('test@example.com', name => 'Test User'); my $dt = DateTime->now()->subtract( weeks => 5 ); @@ -455,5 +446,4 @@ FixMyStreet::override_config { is $plain->header('Content-Type'), 'text/plain; charset="utf-8"', 'email is in right encoding'; }; -$mech->delete_user('test@example.com'); done_testing(); diff --git a/t/app/controller/report_as_other.t b/t/app/controller/report_as_other.t index 96c6df239..86c2deb93 100644 --- a/t/app/controller/report_as_other.t +++ b/t/app/controller/report_as_other.t @@ -121,11 +121,6 @@ subtest "Body user, has permission to add update as another (existing) user" => done_testing(); -END { - $mech->delete_body($body); - $mech->delete_user($_) for @users; -} - sub start_report { my $permission = shift; $_->delete for $user->user_body_permissions; diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index a8c618d49..bcdf612be 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -6,8 +6,6 @@ use DateTime; my $mech = FixMyStreet::TestMech->new; -# create a test user and report -$mech->delete_user('test@example.com'); my $user = $mech->create_user_ok('test@example.com', name => 'Test User'); my $user2 = $mech->create_user_ok('test2@example.com', name => 'Other User'); @@ -579,7 +577,5 @@ subtest "check brackets don't appear when username and report name are the same" }; END { - $mech->delete_user('test@example.com'); - $mech->delete_body($westminster); done_testing(); } diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t index 25875b38a..47113198e 100644 --- a/t/app/controller/report_import.t +++ b/t/app/controller/report_import.t @@ -382,7 +382,3 @@ subtest "Submit a correct entry (with location) to cobrand" => sub { }; done_testing(); - -END { - $mech->delete_body($body); -} diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index a0407cb32..e3d24e9a9 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -274,7 +274,5 @@ FixMyStreet::override_config { END { - $mech->delete_body($oxon); - $mech->delete_body($brum); done_testing(); } diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t index bd9660dea..04f567615 100644 --- a/t/app/controller/report_interest_count.t +++ b/t/app/controller/report_interest_count.t @@ -15,8 +15,6 @@ use DateTime; my $mech = FixMyStreet::TestMech->new; -# create a test user and report -$mech->delete_user('test@example.com'); my $user = $mech->create_user_ok('test@example.com', name => 'Test User'); my $dt = DateTime->new( @@ -128,6 +126,5 @@ subtest 'check support details not shown if not enabled in cobrand' => sub { }; END { - $mech->delete_user('test@example.com'); done_testing(); } diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 0deef8196..52bf6da3e 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1671,7 +1671,3 @@ subtest "inspectors get redirected directly to the report page" => sub { }; done_testing(); - -END { - $mech->delete_body($_) foreach @bodies; -} diff --git a/t/app/controller/report_new_mobile.t b/t/app/controller/report_new_mobile.t index 7f71a2786..296007ce3 100644 --- a/t/app/controller/report_new_mobile.t +++ b/t/app/controller/report_new_mobile.t @@ -36,6 +36,5 @@ subtest "Check signed up for alert when logged in" => sub { }; END { - $mech->delete_user('user@example.org'); done_testing(); } diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t index 4c3fefc56..9a4a81182 100644 --- a/t/app/controller/report_new_open311.t +++ b/t/app/controller/report_new_open311.t @@ -172,7 +172,3 @@ foreach my $test ( } done_testing(); - -END { - $mech->delete_body($body); -} diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 2a20320bc..81174181c 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -5,10 +5,6 @@ use DateTime; my $mech = FixMyStreet::TestMech->new; -# create a test user and report -$mech->delete_user('commenter@example.com'); -$mech->delete_user('test@example.com'); - my $user = $mech->create_user_ok('test@example.com', name => 'Test User'); my $user2 = $mech->create_user_ok('commenter@example.com', name => 'Commenter'); @@ -816,7 +812,7 @@ subtest "check comment with no status change has not status in meta" => sub { $mech->get_ok("/report/$report_id"); $report->discard_changes; - my @updates = $report->comments->all; + my @updates = $report->comments->search(undef, { order_by => ['created', 'id'] })->all; is scalar @updates, 2, 'correct number of updates'; my $update = pop @updates; @@ -849,7 +845,7 @@ subtest "check comment with no status change has not status in meta" => sub { $mech->get_ok("/report/$report_id"); $report->discard_changes; - @updates = $report->comments->search(undef, { order_by => 'created' })->all;; + @updates = $report->comments->search(undef, { order_by => ['created', 'id'] })->all; is scalar @updates, 3, 'correct number of updates'; @@ -879,7 +875,7 @@ subtest "check comment with no status change has not status in meta" => sub { $mech->get_ok("/report/$report_id"); $report->discard_changes; - @updates = $report->comments->search(undef, { order_by => 'created' })->all;; + @updates = $report->comments->search(undef, { order_by => ['created', 'id'] })->all;; is scalar @updates, 4, 'correct number of updates'; $update = pop @updates; @@ -1883,7 +1879,4 @@ subtest 'check cannot answer other user\'s creator fixed questionnaire' => sub { $mech->content_contains( "I'm afraid we couldn't locate your problem in the database." ) }; -ok $comment->delete, 'deleted comment'; -$mech->delete_user('commenter@example.com'); -$mech->delete_user('test@example.com'); done_testing(); diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 8e226de8c..209266940 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -11,10 +11,6 @@ my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id; my $body_fife_id = $mech->create_body_ok(2649, 'Fife Council')->id; my $body_slash_id = $mech->create_body_ok(10000, 'Electricity/Gas Council')->id; -$mech->delete_problems_for_body( $body_west_id ); -$mech->delete_problems_for_body( $body_edin_id ); -$mech->delete_problems_for_body( $body_fife_id ); - my @edinburgh_problems = $mech->create_problems_for_body(3, $body_edin_id, 'All reports'); my @westminster_problems = $mech->create_problems_for_body(5, $body_west_id, 'All reports'); my @fife_problems = $mech->create_problems_for_body(15, $body_fife_id, 'All reports'); @@ -83,7 +79,8 @@ $fife_problems[10]->update( { }); # Run the cron script that makes the data for /reports so we don't get an error. -system( "bin/update-all-reports" ); +use FixMyStreet::Script::UpdateAllReports; +FixMyStreet::Script::UpdateAllReports::generate(); # check that we can get the page $mech->get_ok('/reports'); diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index 2258c9f5b..5ec7bfae7 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -193,6 +193,4 @@ subtest "check RSS feeds on cobrand have correct URLs for non-cobrand reports" = $mech->content_contains($expected2, 'cobrand area report point to cobrand url'); }; -$mech->delete_user( $user1 ); - done_testing(); diff --git a/t/app/load_general_config.t b/t/app/load_general_config.t index aace85c86..a34a5ad69 100644 --- a/t/app/load_general_config.t +++ b/t/app/load_general_config.t @@ -1,10 +1,9 @@ -use strict; -use warnings; - -use Test::More tests => 2; +use FixMyStreet::Test; use_ok 'FixMyStreet'; -is FixMyStreet->config('GAZE_URL'), +is(FixMyStreet->config('GAZE_URL'), 'https://gaze.mysociety.org/gaze', - "check that known config param is loaded"; + "check that known config param is loaded"); + +done_testing(); diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index 2e1298134..eab4ec614 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -504,8 +504,5 @@ subtest "correct i18n-ed summary for state of closed" => sub { }; END { - $mech->delete_user($user) if $user; - $mech->delete_user($user2) if $user2; - $mech->delete_user($user3) if $user3; done_testing(); } diff --git a/t/app/model/comment.t b/t/app/model/comment.t index e83d795fc..3f30b3a1e 100644 --- a/t/app/model/comment.t +++ b/t/app/model/comment.t @@ -1,10 +1,4 @@ -use strict; -use warnings; - -use Test::More tests => 2; - -use FixMyStreet; -use FixMyStreet::DB; +use FixMyStreet::Test; my $comment_rs = FixMyStreet::DB->resultset('Comment'); @@ -23,3 +17,4 @@ my $comment = $comment_rs->new( is $comment->confirmed, undef, 'inflating null confirmed ok'; is $comment->created, undef, 'inflating null confirmed ok'; +done_testing(); diff --git a/t/app/model/db.t b/t/app/model/db.t index bebd68f0b..191058bbe 100644 --- a/t/app/model/db.t +++ b/t/app/model/db.t @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; use_ok 'FixMyStreet::App::Model::DB'; diff --git a/t/app/model/defecttype.t b/t/app/model/defecttype.t index c3e3035a6..ec79c1c8e 100644 --- a/t/app/model/defecttype.t +++ b/t/app/model/defecttype.t @@ -57,7 +57,5 @@ subtest 'Problem->defect_types behaves correctly' => sub { END { - $mech->delete_body( $oxfordshire ); - done_testing(); } diff --git a/t/app/model/extra.t b/t/app/model/extra.t index 2d5c3d5e0..c073ae161 100644 --- a/t/app/model/extra.t +++ b/t/app/model/extra.t @@ -1,13 +1,8 @@ -use strict; -use warnings; -use Test::More; -use utf8; +use FixMyStreet::Test; -use FixMyStreet::DB; use DateTime; -my $db = FixMyStreet::DB->connect; -$db->txn_begin; +my $db = FixMyStreet::DB->storage->schema; my $body = $db->resultset('Body')->create({ name => 'ExtraTestingBody' }); @@ -104,5 +99,4 @@ subtest 'Default hash layout' => sub { }; }; -$db->txn_rollback; done_testing(); diff --git a/t/app/model/moderation.t b/t/app/model/moderation.t index 4dbda3f6c..973b9a70a 100644 --- a/t/app/model/moderation.t +++ b/t/app/model/moderation.t @@ -1,8 +1,5 @@ -use strict; -use warnings; -use Test::More; +use FixMyStreet::Test; use Test::Exception; -use utf8; use FixMyStreet::DB; use DateTime; diff --git a/t/app/model/photoset.t b/t/app/model/photoset.t index 54530adfb..3651a188a 100644 --- a/t/app/model/photoset.t +++ b/t/app/model/photoset.t @@ -1,8 +1,5 @@ -use strict; -use warnings; -use Test::More; +use FixMyStreet::Test; use Test::Exception; -use utf8; use FixMyStreet::DB; use DateTime; @@ -23,8 +20,6 @@ FixMyStreet::override_config { UPLOAD_DIR => $UPLOAD_DIR, }, sub { -$db->txn_begin; - my $image_path = path('t/app/controller/sample.jpg'); sub make_report { @@ -74,8 +69,6 @@ subtest 'Photoset with 3 referenced photo' => sub { is $photoset->num_images, 3, 'Found 3 images'; }; -$db->txn_rollback; - }; done_testing(); diff --git a/t/app/model/problem.t b/t/app/model/problem.t index d95aec98d..142262ae9 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -875,11 +875,5 @@ subtest 'return how many days ago a problem was reported' => sub { }; END { - $problem->comments->delete if $problem; - $problem->delete if $problem; - $mech->delete_user( $user ) if $user; - - $mech->delete_body($_) for @bodies; - done_testing(); } diff --git a/t/app/model/questionnaire.t b/t/app/model/questionnaire.t index 9685c5345..169895f95 100644 --- a/t/app/model/questionnaire.t +++ b/t/app/model/questionnaire.t @@ -108,6 +108,4 @@ for my $test ( } } -$mech->delete_user( $user ); - done_testing(); diff --git a/t/app/model/rabx_column.t b/t/app/model/rabx_column.t index 607d578ce..9232a92f0 100644 --- a/t/app/model/rabx_column.t +++ b/t/app/model/rabx_column.t @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; use_ok "FixMyStreet::DB::RABXColumn"; diff --git a/t/app/model/token.t b/t/app/model/token.t index e31901187..60b170a26 100644 --- a/t/app/model/token.t +++ b/t/app/model/token.t @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; use FixMyStreet; use FixMyStreet::DB; diff --git a/t/app/model/user.t b/t/app/model/user.t index 76d395fdc..5a9c898a2 100644 --- a/t/app/model/user.t +++ b/t/app/model/user.t @@ -64,7 +64,6 @@ FixMyStreet::override_config { }; END { - $mech->delete_user( $problem->user ) if $problem; done_testing(); } diff --git a/t/app/model/user_planned_report.t b/t/app/model/user_planned_report.t index 3473e1bbd..f2fe79cc2 100644 --- a/t/app/model/user_planned_report.t +++ b/t/app/model/user_planned_report.t @@ -40,8 +40,3 @@ is $user2->active_planned_reports, 0; is $user2->planned_reports, 1; done_testing(); - -END { - $mech->delete_user($user); - $mech->delete_user($user2); -} diff --git a/t/app/script/archive_old_enquiries.t b/t/app/script/archive_old_enquiries.t index 148f73cf2..fb1949d9f 100644 --- a/t/app/script/archive_old_enquiries.t +++ b/t/app/script/archive_old_enquiries.t @@ -155,8 +155,3 @@ subtest 'user with new reports does not get email' => sub { }; done_testing(); - -END { - $mech->delete_user($user); - $mech->delete_body($oxfordshire); -} diff --git a/t/app/sendreport/angus.t b/t/app/sendreport/angus.t index a19ee483a..41379b4ff 100644 --- a/t/app/sendreport/angus.t +++ b/t/app/sendreport/angus.t @@ -1,9 +1,4 @@ -use strict; -use warnings; - -use FixMyStreet::DB; - -use Test::More; +use FixMyStreet::Test; use_ok("FixMyStreet::SendReport::Angus"); diff --git a/t/app/sendreport/email.t b/t/app/sendreport/email.t index a9bc9f2b1..0cdf49378 100644 --- a/t/app/sendreport/email.t +++ b/t/app/sendreport/email.t @@ -69,7 +69,3 @@ foreach my $test ( { } done_testing(); - -END { - $mech->delete_body($body); -} diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t index 4301c259a..684395bac 100644 --- a/t/app/sendreport/inspection_required.t +++ b/t/app/sendreport/inspection_required.t @@ -99,8 +99,3 @@ subtest 'Uninspected report is sent when user rep is high enough' => sub { }; done_testing(); - -END { - $mech->delete_user($user); - $mech->delete_body($body); -} diff --git a/t/app/sendreport/open311.t b/t/app/sendreport/open311.t index c4c17577c..b60b199b0 100644 --- a/t/app/sendreport/open311.t +++ b/t/app/sendreport/open311.t @@ -1,7 +1,5 @@ -use strict; -use warnings; +use FixMyStreet::Test; -use Test::More; use Test::Deep; use Open311; @@ -160,11 +158,11 @@ sub test_overrides { ALLOWED_COBRANDS => ['fixmystreet', 'oxfordshire', 'bromley', 'westberkshire', 'greenwich'], }, sub { my $db = FixMyStreet::DB->storage->schema; - $db->txn_begin; + #$db->txn_begin; my $params = { id => $input->{body_id}, name => $input->{body_name} }; my $body = $db->resultset('Body')->find_or_create($params); - $body->body_areas->create({ area_id => $input->{body_id} }); + $body->body_areas->find_or_create({ area_id => $input->{body_id} }); ok $body, "found/created body " . $input->{body_name}; $body->update({ can_be_devolved => 1 }); @@ -182,7 +180,7 @@ sub test_overrides { ); $contact->update({ send_method => 'Open311', endpoint => 'http://example.com/open311' }); - my $user = $db->resultset('User')->create( { + my $user = $db->resultset('User')->find_or_create( { name => 'Fred Bloggs', email => TEST_USER_EMAIL, password => 'dummy', @@ -215,7 +213,7 @@ sub test_overrides { or diag Dumper( Open311->_get_test_data ); Open311->_reset_test_data(); - $db->txn_rollback; + #$db->txn_rollback; }; } } diff --git a/t/app/uri_for.t b/t/app/uri_for.t index 9cbcd3767..7d9c8dc07 100644 --- a/t/app/uri_for.t +++ b/t/app/uri_for.t @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; # FIXME Should this be here? A better way? uri_for varies by map. use Catalyst::Test 'FixMyStreet::App'; diff --git a/t/app/view/web.t b/t/app/view/web.t index 0f49b986b..3a95a2ad7 100644 --- a/t/app/view/web.t +++ b/t/app/view/web.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More; + use Test::More; BEGIN { use_ok 'FixMyStreet::App::View::Web' } diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index ad0ef7b14..46c2472cd 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -128,7 +128,4 @@ for my $test ( }; } -# Clean up -$mech->delete_user($user); -$mech->delete_body($body); done_testing(); diff --git a/t/cobrand/closest.t b/t/cobrand/closest.t index a7d09842b..088349f39 100644 --- a/t/cobrand/closest.t +++ b/t/cobrand/closest.t @@ -78,6 +78,5 @@ FixMyStreet::override_config { }; END { - $mech->delete_user( $user ); done_testing(); } diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t index 1ae637229..1e6bd7e65 100644 --- a/t/cobrand/fixamingata.t +++ b/t/cobrand/fixamingata.t @@ -107,7 +107,6 @@ subtest "Test ajax decimal points" => sub { }; END { - $mech->delete_body($body); ok $mech->host("www.fixmystreet.com"), "change host back"; done_testing(); } diff --git a/t/cobrand/form_extras.t b/t/cobrand/form_extras.t index e0727018f..f450d908e 100644 --- a/t/cobrand/form_extras.t +++ b/t/cobrand/form_extras.t @@ -63,6 +63,5 @@ FixMyStreet::override_config { }; END { - $mech->delete_problems_for_body(undef); done_testing(); } diff --git a/t/cobrand/get_body_sender.t b/t/cobrand/get_body_sender.t index b71dece7e..a53472128 100644 --- a/t/cobrand/get_body_sender.t +++ b/t/cobrand/get_body_sender.t @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; use mySociety::Locale; use FixMyStreet::DB; diff --git a/t/cobrand/loading.t b/t/cobrand/loading.t index b4738fb63..16c7b4ab7 100644 --- a/t/cobrand/loading.t +++ b/t/cobrand/loading.t @@ -1,7 +1,5 @@ -use strict; -use warnings; +use FixMyStreet::Test; -use Test::More; use Sub::Override; use FixMyStreet; diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t index 7a7d85412..5452a0fde 100644 --- a/t/cobrand/oxfordshire.t +++ b/t/cobrand/oxfordshire.t @@ -109,10 +109,6 @@ EOF } }; -# Clean up END { - $mech->delete_user( $superuser ); - $mech->delete_user( $inspector ); - $mech->delete_problems_for_body( $oxon->id ); done_testing(); } diff --git a/t/cobrand/restriction.t b/t/cobrand/restriction.t index 4d15cdc48..9e3018625 100644 --- a/t/cobrand/restriction.t +++ b/t/cobrand/restriction.t @@ -50,5 +50,4 @@ is($cobrand->updates->count, 1, 'One update in the right cobrand'); my $nearby = $c->model('DB::Nearby')->nearby($c, 5, [], 10, 0.003, 0.004); is(@$nearby, 1, 'One report close to the origin point'); -$mech->delete_problems_for_body(1234); done_testing(); diff --git a/t/cobrand/two_tier.t b/t/cobrand/two_tier.t index 6c6a36758..c8a16ea9a 100644 --- a/t/cobrand/two_tier.t +++ b/t/cobrand/two_tier.t @@ -1,8 +1,4 @@ -use strict; -use warnings; -use Test::More; - -use FixMyStreet; +use FixMyStreet::Test; use FixMyStreet::Cobrand; my @cobrands = ( diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 947baaec8..be5dcbb48 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -978,12 +978,6 @@ FixMyStreet::override_config { }; END { - $mech->delete_body($subdivision); - $mech->delete_body($division); - $mech->delete_body($zurich); - $mech->delete_body($external_body); - $mech->delete_user( 'dm1@example.org' ); - $mech->delete_user( 'sdm1@example.org' ); ok $mech->host("www.fixmystreet.com"), "change host back"; done_testing(); } @@ -1,7 +1,4 @@ -use strict; -use warnings; - -use Test::More; +use FixMyStreet::Test; use FixMyStreet::Email; my $secret = FixMyStreet::DB->resultset('Secret')->update({ diff --git a/t/map/tilma/original.t b/t/map/tilma/original.t index a38c69e68..4766e9363 100644 --- a/t/map/tilma/original.t +++ b/t/map/tilma/original.t @@ -13,7 +13,6 @@ mySociety::Locale::gettext_domain('FixMyStreet'); FixMyStreet::Map::set_map_class(); my $c = ctx_request('http://fixmystreet.com/test?bbox=-7.6,49.7,-7.5,49.8'); -$mech->delete_user('test@example.com'); my $user = FixMyStreet::DB->resultset('User') ->find_or_create( { email => 'test@example.com', name => 'Test User' } ); @@ -111,7 +110,4 @@ for my $test ( }; } -$mech->delete_user( $user ); - - done_testing(); diff --git a/t/open311.t b/t/open311.t index 06dec6a6f..a24a0af00 100644 --- a/t/open311.t +++ b/t/open311.t @@ -1,8 +1,6 @@ #!/usr/bin/env perl -use utf8; -use strict; -use warnings; +use FixMyStreet::Test; use File::Temp 'tempdir'; use Path::Tiny; use Test::More; diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 8876a3ccf..a7dd8425b 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -1,8 +1,6 @@ #!/usr/bin/env perl -use strict; -use warnings; -use Test::More; +use FixMyStreet::Test; use CGI::Simple; use LWP::Protocol::PSGI; use t::Mock::Static; diff --git a/t/open311/getupdates.t b/t/open311/getupdates.t index a2ea70c09..1cbabc5ab 100644 --- a/t/open311/getupdates.t +++ b/t/open311/getupdates.t @@ -1,8 +1,6 @@ #!/usr/bin/env perl -use strict; -use warnings; -use Test::More; +use FixMyStreet::Test; use URI::Split qw(uri_split); use FixMyStreet; diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t index 606bcbc44..3ebe8e535 100644 --- a/t/open311/populate-service-list.t +++ b/t/open311/populate-service-list.t @@ -1,9 +1,6 @@ #!/usr/bin/env perl -use strict; -use warnings; -use Test::More; - +use FixMyStreet::Test; use FixMyStreet::DB; use_ok( 'Open311::PopulateServiceList' ); diff --git a/t/sendreport/open311.t b/t/sendreport/open311.t index 4dfbde5bd..52b1952f4 100644 --- a/t/sendreport/open311.t +++ b/t/sendreport/open311.t @@ -40,7 +40,4 @@ subtest 'testing Open311 behaviour', sub { is $c->param('jurisdiction_id'), 'FMS', 'Request had correct jurisdiction'; }; -# Clean up -$mech->delete_user($user); -$mech->delete_body($body); done_testing(); |