diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/admin.t | 16 | ||||
-rw-r--r-- | t/app/controller/reports.t | 2 | ||||
-rw-r--r-- | t/app/model/problem.t | 2 | ||||
-rw-r--r-- | t/app/sendreport/email.t | 4 | ||||
-rw-r--r-- | t/cobrand/fixmybarangay.t | 23 | ||||
-rw-r--r-- | t/open311.t | 4 | ||||
-rw-r--r-- | t/open311/getservicerequestupdates.t | 4 | ||||
-rw-r--r-- | t/open311/populate-service-list.t | 4 | ||||
-rw-r--r-- | t/utils.t | 4 |
9 files changed, 34 insertions, 29 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 9ff5b5c90..f63a72117 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -201,12 +201,12 @@ subtest 'check contact creation' => sub { note => 'test/note', non_public => 'on', } } ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test/category'); + $mech->get_ok('/admin/body/' . $body->id . '/test/category'); }; subtest 'check contact editing' => sub { - $mech->get_ok('/admin/body_edit/' . $body->id .'/test%20category'); + $mech->get_ok('/admin/body/' . $body->id .'/test%20category'); $mech->submit_form_ok( { with_fields => { email => 'test2@example.com', @@ -219,7 +219,7 @@ subtest 'check contact editing' => sub { $mech->content_contains( '<td>test2 note' ); $mech->content_contains( 'Private: No' ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->submit_form_ok( { with_fields => { email => 'test2@example.com', note => 'test2 note', @@ -228,12 +228,12 @@ subtest 'check contact editing' => sub { $mech->content_contains( 'Private: Yes' ); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_contains( '<td><strong>test2@example.com' ); }; subtest 'check contact updating' => sub { - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_like(qr{test2\@example.com</strong>[^<]*</td>[^<]*<td>No}s); $mech->get_ok('/admin/body/' . $body->id); @@ -243,7 +243,7 @@ subtest 'check contact updating' => sub { $mech->submit_form_ok({form_number => 1}); $mech->content_like(qr'test2@example.com</td>[^<]*<td>\s*Confirmed: Yes's); - $mech->get_ok('/admin/body_edit/' . $body->id . '/test%20category'); + $mech->get_ok('/admin/body/' . $body->id . '/test%20category'); $mech->content_like(qr{test2\@example.com[^<]*</td>[^<]*<td><strong>Yes}s); }; @@ -266,7 +266,7 @@ subtest 'check open311 configuring' => sub { } ); $mech->content_contains('Council contacts configured via Open311'); - $mech->content_contains('Configuration updated - contacts will be generated automatically later'); + $mech->content_contains('Values updated'); my $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); is $conf->endpoint, 'http://example.com/open311', 'endpoint configured'; @@ -286,7 +286,7 @@ subtest 'check open311 configuring' => sub { } ); - $mech->content_contains('Configuration updated'); + $mech->content_contains('Values updated'); $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); is $conf->endpoint, 'http://example.org/open311', 'endpoint updated'; diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 1b4fc3526..ecb43f447 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -85,7 +85,7 @@ $fife_problems[10]->update( { }); # Run the cron script that makes the data for /reports so we don't get an error. -system( "bin/cron-wrapper update-all-reports" ); +system( "bin/update-all-reports" ); # check that we can get the page $mech->get_ok('/reports'); diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 6ad933db8..c40e9e022 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -5,9 +5,9 @@ use warnings; use Test::More; +use FixMyStreet::TestMech; use FixMyStreet; use FixMyStreet::App; -use FixMyStreet::TestMech; use mySociety::Locale; use Sub::Override; diff --git a/t/app/sendreport/email.t b/t/app/sendreport/email.t index 8063c928f..b2cab42ed 100644 --- a/t/app/sendreport/email.t +++ b/t/app/sendreport/email.t @@ -50,14 +50,14 @@ foreach my $test ( { }, { desc => 'unconfirmed contact results in no receipients', - count => undef, + count => 0, add_council => 1, unconfirmed => 1, expected_note => 'Body 1000 deleted', }, { desc => 'unconfirmed contact note uses note from contact table', - count => undef, + count => 0, add_council => 1, unconfirmed => 1, note => 'received bounced so unconfirmed', diff --git a/t/cobrand/fixmybarangay.t b/t/cobrand/fixmybarangay.t index a431ca62b..edb14fe3d 100644 --- a/t/cobrand/fixmybarangay.t +++ b/t/cobrand/fixmybarangay.t @@ -28,7 +28,7 @@ $luz->update( { send_method => 'Email' } ); my $bsn = $mech->create_body_ok( 2, 'Bgy BSN', id => 2 ); $bsn->update( { send_method => 'Email' } ); -my $dps = $mech->create_body_ok( 3, 'DPS' ); +my $dps = $mech->create_body_ok( 3, 'DPS', id => 3 ); $dps->update( { send_method => 'Open311', endpoint => 'http://dps.endpoint.example.com', jurisdiction => 'FMB', api_key => 'test' } ); FixMyStreet::App->model('DB::BodyArea')->find_or_create({ area_id => 1, body_id => $dps->id }); FixMyStreet::App->model('DB::BodyArea')->find_or_create({ area_id => 2, body_id => $dps->id }); @@ -104,6 +104,27 @@ my $fmb_test_email = 'luz_test_user@example.com'; my $user = FixMyStreet::App->model('DB::User')->find_or_create( { email => $fmb_test_email, from_body => $luz->id, password => 'fmbsecret' } ); ok $user, "test user does exist"; +my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create({ + user => $user, + parameter => '-0.142497580865087', + parameter2 => '51.5016605453401', + alert_type => 'local_problems', + whensubscribed => '2014-01-01 10:00:00', + confirmed => 1, + cobrand => 'fixmybarangay', +}); + +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fixmybarangay' ], +}, sub { + FixMyStreet::App->model('DB::AlertType')->email_alerts(); +}; + +$mech->email_count_is(1); +$email = $mech->get_email; +like $email->body, qr/The following FixMyBarangay reports/, 'Start of email looks correct'; +$mech->clear_emails_ok; + $mech->log_out_ok; $mech->get_ok( '/report/' . $luz_report->id ); $mech->content_lacks( "Remove from site" ); diff --git a/t/open311.t b/t/open311.t index 0caacbffc..15bebe2fc 100644 --- a/t/open311.t +++ b/t/open311.t @@ -11,10 +11,6 @@ use HTTP::Response; use DateTime; use DateTime::Format::W3CDTF; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311' ); my $o = Open311->new(); diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 00c25a83e..dac10d69b 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -5,10 +5,6 @@ use warnings; use Test::More; use CGI::Simple; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311' ); use_ok( 'Open311::GetServiceRequestUpdates' ); diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t index d9d65945b..b343b206d 100644 --- a/t/open311/populate-service-list.t +++ b/t/open311/populate-service-list.t @@ -6,10 +6,6 @@ use Test::More; use FixMyStreet::App; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311::PopulateServiceList' ); use_ok( 'Open311' ); @@ -4,10 +4,6 @@ use strict; use warnings; use Test::More; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use Utils; my @truncate_tests = ( |