diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-05-07 18:03:28 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-05-07 18:03:28 +0100 |
commit | 952e759f17d2920cca8620fb987947415bdb5898 (patch) | |
tree | 454bb0bc01e65ab205056f2e8d895b4e227c8b09 /t | |
parent | 408d9c08e172c0a6023a15f786c534839a2c56c9 (diff) |
Update some tests to work around small changes in some underlying modules.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/report_new.t | 10 | ||||
-rw-r--r-- | t/app/helpers/send_email.t | 17 | ||||
-rw-r--r-- | t/app/uri_for.t | 57 | ||||
-rw-r--r-- | t/cobrand/fixmybarangay.t | 7 | ||||
-rw-r--r-- | t/map/tilma/original.t | 8 | ||||
-rw-r--r-- | t/open311.t | 3 |
6 files changed, 26 insertions, 76 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 722c3c39c..818f9e625 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -955,7 +955,7 @@ subtest "check that a lat/lon off coast leads to /around" => sub { for my $test ( { desc => 'user title not set if not bromley problem', - host => 'http://www.fixmystreet.com', + host => 'www.fixmystreet.com', postcode => 'EH99 1SP', fms_extra_title => '', extra => undef, @@ -963,7 +963,7 @@ for my $test ( }, { desc => 'title shown for bromley problem on main site', - host => 'http://www.fixmystreet.com', + host => 'www.fixmystreet.com', postcode => 'BR1 3UH', fms_extra_title => 'MR', extra => [ @@ -978,7 +978,7 @@ for my $test ( { desc => 'title, first and last name shown for bromley problem on cobrand', - host => 'http://bromley.fixmystreet.com', + host => 'bromley.fixmystreet.com', postcode => 'BR1 3UH', first_name => 'Test', last_name => 'User', @@ -1093,7 +1093,7 @@ for my $test ( subtest 'user title not reset if no user title in submission' => sub { $mech->log_out_ok; - $mech->host( 'http://fixmystreet.com' ); + $mech->host( 'fixmystreet.com' ); my $user = $mech->log_in_ok( 'userwithtitle@example.com' ); @@ -1174,7 +1174,7 @@ SKIP: { ) { subtest $test->{ desc } => sub { my $test_email = 'test-22@example.com'; - $mech->host( 'http://lichfielddc.fixmystreet.com/' ); + $mech->host( 'lichfielddc.fixmystreet.com' ); $mech->clear_emails_ok; $mech->log_out_ok; diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t index 3067d90f3..14c7d363b 100644 --- a/t/app/helpers/send_email.t +++ b/t/app/helpers/send_email.t @@ -9,23 +9,14 @@ BEGIN { FixMyStreet->test_mode(1); } -use Test::More tests => 6; +use Test::More tests => 5; + +use Catalyst::Test 'FixMyStreet::App'; use Email::Send::Test; use Path::Class; -use_ok 'FixMyStreet::App'; -my $c = FixMyStreet::App->new( - { - request => Catalyst::Request->new( - { - base => URI->new('http://fixmystreet.com/'), - uri => URI->new('http://fixmystreet.com/') - } - ), - } -); -$c->setup_request(); +my $c = ctx_request("/"); # set some values in the stash $c->stash->{foo} = 'bar'; diff --git a/t/app/uri_for.t b/t/app/uri_for.t index eecf30e32..bf965fb62 100644 --- a/t/app/uri_for.t +++ b/t/app/uri_for.t @@ -4,7 +4,7 @@ use warnings; use Test::More; # FIXME Should this be here? A better way? uri_for varies by map. -use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App'; +use Catalyst::Test 'FixMyStreet::App'; FixMyStreet::Map::set_map_class(); # structure of these tests borrowed from '/t/aggregate/unit_core_uri_for.t' @@ -15,43 +15,9 @@ use URI; use_ok('FixMyStreet::App'); -my $fms_c = FixMyStreet::App->new( - { - request => Catalyst::Request->new( - { - base => URI->new('http://www.fixmystreet.com/'), - uri => URI->new('http://www.fixmystreet.com/test_namespace') - } - ), - namespace => 'test_namespace', - } -); - -my $fgm_c = FixMyStreet::App->new( - { - request => Catalyst::Request->new( - { - base => URI->new('http://www.fiksgatami.no/'), - uri => URI->new('http://www.fiksgatami.no/test_namespace') - } - ), - namespace => 'test_namespace', - } -); - -my $reh_en_c = FixMyStreet::App->new( - { - request => Catalyst::Request->new( - { - base => URI->new('http://reportemptyhomes.com/'), - uri => URI->new('http://reportemptyhomes.com/test_namespace') - } - ), - namespace => 'test_namespace', - } -); -$reh_en_c->setup_request(); - +my $fms_c = ctx_request('http://www.fixmystreet.com/'); +my $fgm_c = ctx_request('http://www.fiksgatami.no/'); +my $reh_en_c = ctx_request('http://reportemptyhomes.com/'); is( $fms_c->uri_for('/bar/baz') . "", @@ -61,7 +27,7 @@ is( is( $fms_c->uri_for('') . "", - 'http://www.fixmystreet.com/test_namespace', + 'http://www.fixmystreet.com/', 'URI for namespace' ); @@ -90,18 +56,7 @@ SKIP: { # instantiate this here otherwise sets locale to cy and breaks test # above - my $reh_cy_c = FixMyStreet::App->new( - { - request => Catalyst::Request->new( - { - base => URI->new('http://cy.reportemptyhomes.com/'), - uri => URI->new('http://cy.reportemptyhomes.com/test_namespace') - } - ), - namespace => 'test_namespace', - } - ); - $reh_cy_c->setup_request(); + my $reh_cy_c = ctx_request('http://cy.reportemptyhomes.com/'); like( $reh_cy_c->uri_for_email( '/foo' ), diff --git a/t/cobrand/fixmybarangay.t b/t/cobrand/fixmybarangay.t index d02dbe2e3..c0823eac4 100644 --- a/t/cobrand/fixmybarangay.t +++ b/t/cobrand/fixmybarangay.t @@ -2,9 +2,14 @@ use strict; use warnings; use Test::More; -plan skip_all => 'Skipping Zurich test without FixMyBarangay cobrand' +plan skip_all => 'Skipping FixMyBarangay test without FixMyBarangay cobrand' unless FixMyStreet::Cobrand->exists('fixmybarangay'); +BEGIN { + use FixMyStreet; + FixMyStreet->test_mode(1); +} + use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; diff --git a/t/map/tilma/original.t b/t/map/tilma/original.t index 72cde5f9f..9e296686d 100644 --- a/t/map/tilma/original.t +++ b/t/map/tilma/original.t @@ -9,16 +9,14 @@ use FixMyStreet::TestMech; use DateTime; use mySociety::Locale; +use Catalyst::Test 'FixMyStreet::App'; + my $mech = FixMyStreet::TestMech->new; mySociety::Locale::gettext_domain('FixMyStreet'); FixMyStreet::Map::set_map_class(); -my $r = Catalyst::Request->new( { base => URI->new('/'), uri => URI->new('http://fixmystreet.com/test'), parameters => { bbox => '-7.6,49.7,-7.5,49.8' } } ); - -my $c = FixMyStreet::App->new( { - request => $r, -}); +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 = diff --git a/t/open311.t b/t/open311.t index 71a87325c..6795b929c 100644 --- a/t/open311.t +++ b/t/open311.t @@ -86,13 +86,14 @@ EOT ; my $c = CGI::Simple->new( $results->{ req }->content ); + (my $c_description = $c->param('description')) =~ s/\r\n/\n/g; is $c->param('email'), $user->email, 'correct email'; is $c->param('first_name'), 'Test', 'correct first name'; is $c->param('last_name'), 'User', 'correct last name'; is $c->param('lat'), 1, 'latitide correct'; is $c->param('long'), 2, 'longitude correct'; - is $c->param('description'), $description, 'description correct'; + is $c_description, $description, 'description correct'; is $c->param('service_code'), 'pothole', 'service code correct'; }; |