diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-01-28 11:52:39 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-01-28 11:52:39 +0000 |
commit | 441debff0a773697859c528abbafbe2dd08cbd97 (patch) | |
tree | 408c7fefb2caa24feb666c98ed1dcec35bc53263 /t | |
parent | 086031a5396c02c1d4cb96ad69e648aacd92df45 (diff) |
Improve tests to not assume BASE_URL is localhost, and remove couple of warnings.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/report_new.t | 13 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 2 | ||||
-rw-r--r-- | t/app/sendreport/email.t | 1 |
3 files changed, 9 insertions, 7 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 6cfa67116..0206feed3 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1084,7 +1084,6 @@ SKIP: { desc => 'confirm link for cobrand council in two tier cobrand links to cobrand site', category => 'Trees', council => 2434, - link_base => 'http://lichfielddc.localhost/', national => 0, button => 'submit_register', }, @@ -1092,7 +1091,6 @@ SKIP: { desc => 'confirm link for non cobrand council in two tier cobrand links to national site', category => 'Street Lighting', council => 2240, - link_base => 'http://localhost/', national => 1, button => 'submit_register', }, @@ -1100,7 +1098,6 @@ SKIP: { desc => 'confirm redirect for cobrand council in two tier cobrand redirects to cobrand site', category => 'Trees', council => 2434, - link_base => 'lichfielddc.localhost', national => 0, redirect => 1, }, @@ -1108,7 +1105,6 @@ SKIP: { desc => 'confirm redirect for non cobrand council in two tier cobrand redirect to national site', category => 'Street Lighting', council => 2240, - link_base => 'localhost', national => 1, redirect => 1, }, @@ -1163,7 +1159,10 @@ SKIP: { if ( $test->{redirect} ) { is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; - is $mech->uri->host, $test->{link_base}, 'redirected to correct site'; + my $base = FixMyStreet->config('BASE_URL'); + $base =~ s{http://}{}; + $base = "lichfielddc.$base" unless $test->{national}; + is $mech->uri->host, $base, 'redirected to correct site'; } else { # receive token my $email = $mech->get_email; @@ -1176,7 +1175,9 @@ SKIP: { # confirm token $mech->get_ok($url); - $mech->content_contains( $test->{link_base} . 'report/' . + my $base = FixMyStreet->config('BASE_URL'); + $base =~ s{http://}{http://lichfielddc.} unless $test->{national}; + $mech->content_contains( $base . '/report/' . $report->id, 'confirm page links to correct site' ); if ( $test->{national} ) { diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 7d88a2d4f..bb88dcf05 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -750,7 +750,7 @@ subtest "check comment with no status change has not status in meta" => sub { like $update_meta->[2], qr/marked as investigating/, 'third update meta says investigating'; my $dt = DateTime->now->add( seconds => 1 ); - my $comment = FixMyStreet::App->model('DB::Comment')->find_or_create( + $comment = FixMyStreet::App->model('DB::Comment')->find_or_create( { problem_id => $report_id, user_id => $user->id, diff --git a/t/app/sendreport/email.t b/t/app/sendreport/email.t index f0e1f153a..84379394d 100644 --- a/t/app/sendreport/email.t +++ b/t/app/sendreport/email.t @@ -28,6 +28,7 @@ my $contact = FixMyStreet::App->model('DB::Contact')->find_or_create( my $row = FixMyStreet::App->model('DB::Problem')->new( { council => '1000', category => 'category', + cobrand => '', } ); ok $e; |