diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/admin.t | 6 | ||||
-rw-r--r-- | t/app/controller/admin_permissions.t | 4 | ||||
-rw-r--r-- | t/app/controller/alert.t | 24 | ||||
-rw-r--r-- | t/app/controller/alert_new.t | 22 | ||||
-rw-r--r-- | t/app/controller/around.t | 20 | ||||
-rw-r--r-- | t/app/controller/auth.t | 4 | ||||
-rw-r--r-- | t/app/controller/auth_social.t | 9 | ||||
-rw-r--r-- | t/app/controller/dashboard.t | 4 | ||||
-rw-r--r-- | t/app/controller/index.t | 9 | ||||
-rw-r--r-- | t/app/controller/photo.t | 2 | ||||
-rw-r--r-- | t/app/controller/report_as_other.t | 13 | ||||
-rw-r--r-- | t/app/controller/report_import.t | 14 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 4 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 55 | ||||
-rw-r--r-- | t/app/controller/report_new_mobile.t | 8 | ||||
-rw-r--r-- | t/app/controller/report_new_open311.t | 8 | ||||
-rw-r--r-- | t/app/controller/reports.t | 14 | ||||
-rw-r--r-- | t/app/controller/rss.t | 6 |
18 files changed, 107 insertions, 119 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index ab6cac842..2fdd8b74a 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -1,9 +1,7 @@ use strict; use warnings; use Test::More; -use LWP::Protocol::PSGI; -use t::Mock::MapIt; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -148,7 +146,7 @@ subtest 'check summary counts' => sub { # This override is wrapped around ALL the /admin/body tests FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', MAPIT_TYPES => [ 'UTA' ], BASE_URL => 'http://www.example.org', }, sub { @@ -580,7 +578,6 @@ foreach my $test ( } FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', ALLOWED_COBRANDS => 'fixmystreet', }, sub { @@ -1204,7 +1201,6 @@ my %default_perms = ( FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', }, sub { - LWP::Protocol::PSGI->register(t::Mock::MapIt->run_if_script, host => 'mapit.uk'); for my $test ( { desc => 'edit user name', diff --git a/t/app/controller/admin_permissions.t b/t/app/controller/admin_permissions.t index 4b05660cc..dd256173d 100644 --- a/t/app/controller/admin_permissions.t +++ b/t/app/controller/admin_permissions.t @@ -1,9 +1,7 @@ use strict; use warnings; use Test::More; -use LWP::Protocol::PSGI; -use t::Mock::MapIt; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -84,8 +82,6 @@ FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => [ 'oxfordshire' ], }, sub { - LWP::Protocol::PSGI->register(t::Mock::MapIt->run_if_script, host => 'mapit.uk'); - my $user2_id = $user2->id; $report->update({ bodies_str => $oxfordshire->id }); diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index c42eba6b8..cb5949b8f 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -17,7 +17,7 @@ $mech->content_contains('html class="no-js" lang="en-gb"'); # check that we can get list page FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', GEOCODER => '', }, sub { $mech->get_ok('/alert/list'); @@ -25,21 +25,21 @@ FixMyStreet::override_config { $mech->content_contains('Local RSS feeds and email alerts'); $mech->content_contains('html class="no-js" lang="en-gb"'); - $mech->get_ok('/alert/list?pc=EH99 1SP'); + $mech->get_ok('/alert/list?pc=EH1 1BB'); $mech->title_like(qr/^Local RSS feeds and email alerts/); - $mech->content_contains('Here are the types of local problem alerts for ‘EH99 1SP’'); + $mech->content_contains('Here are the types of local problem alerts for ‘EH1 1BB’'); $mech->content_contains('html class="no-js" lang="en-gb"'); $mech->content_contains('Problems within 10.0km'); - $mech->content_contains('rss/pc/EH991SP/2'); - $mech->content_contains('rss/pc/EH991SP/5'); - $mech->content_contains('rss/pc/EH991SP/10'); - $mech->content_contains('rss/pc/EH991SP/20'); - $mech->content_contains('Problems within City of Edinburgh'); + $mech->content_contains('rss/pc/EH11BB/2'); + $mech->content_contains('rss/pc/EH11BB/5'); + $mech->content_contains('rss/pc/EH11BB/10'); + $mech->content_contains('rss/pc/EH11BB/20'); + $mech->content_contains('Problems within Edinburgh City'); $mech->content_contains('Problems within City Centre ward'); - $mech->content_contains('/rss/reports/City+of+Edinburgh'); - $mech->content_contains('/rss/reports/City+of+Edinburgh/City+Centre'); - $mech->content_contains('council:2651:City_of_Edinburgh'); - $mech->content_contains('ward:2651:20728:City_of_Edinburgh:City_Centre'); + $mech->content_contains('/rss/reports/Edinburgh'); + $mech->content_contains('/rss/reports/Edinburgh/City+Centre'); + $mech->content_contains('council:2651:Edinburgh'); + $mech->content_contains('ward:2651:20728:Edinburgh:City_Centre'); subtest "Test Nominatim lookup" => sub { LWP::Protocol::PSGI->register(t::Mock::Nominatim->run_if_script, host => 'nominatim.openstreetmap.org'); diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 1b85adf7e..ea38f7c25 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -208,7 +208,7 @@ foreach my $test ( FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/alert/list?pc=EH991SP'); }; @@ -312,7 +312,7 @@ subtest "Test two-tier council alerts" => sub { ) { FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok( '/alert/list?pc=GL502PR' ); $mech->submit_form_ok( { @@ -351,7 +351,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { $mech->get_ok( '/alert' ); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'EH11BB' } } ); $mech->submit_form_ok( { @@ -371,7 +371,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { } } - my $dt = DateTime->now()->add( days => 2); + my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2); my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser; @@ -436,7 +436,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { ok $update, "created test update - $update_id"; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { FixMyStreet::App->model('DB::AlertType')->email_alerts(); }; @@ -447,7 +447,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { for (@emails) { my $body = $mech->get_text_body_from_email($_); $count++ if $body =~ /The following updates have been left on this report:/; - $count++ if $body =~ /The following new FixMyStreet reports have been added in the City of\s+Edinburgh\s+Council area:/; + $count++ if $body =~ /The following new FixMyStreet reports have been added in the Area 2651 area:/; $count++ if $body =~ /The following FixMyStreet reports have been made within the area you\s+specified:/; $count++ if $body =~ /\s+-\s+Testing/; } @@ -486,7 +486,7 @@ subtest "Test signature template is used from cobrand" => sub { my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User' ); - my $dt = DateTime->now()->add( days => 2); + my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2); my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser; @@ -542,7 +542,7 @@ subtest "Test signature template is used from cobrand" => sub { $mech->clear_emails_ok; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], }, sub { FixMyStreet::App->model('DB::AlertType')->email_alerts(); @@ -570,7 +570,7 @@ subtest "Test signature template is used from cobrand" => sub { $mech->clear_emails_ok; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], }, sub { FixMyStreet::App->model('DB::AlertType')->email_alerts(); @@ -665,7 +665,7 @@ for my $test ( $mech->clear_emails_ok; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { FixMyStreet::App->model('DB::AlertType')->email_alerts(); }; @@ -673,7 +673,7 @@ for my $test ( $report->update( { non_public => 0 } ); FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { FixMyStreet::App->model('DB::AlertType')->email_alerts(); }; diff --git a/t/app/controller/around.t b/t/app/controller/around.t index 9e2e7c524..c8aca04aa 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -1,9 +1,7 @@ use strict; use warnings; use Test::More; -use LWP::Protocol::PSGI; -use t::Mock::MapIt; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -17,7 +15,7 @@ subtest "check that if no query we get sent back to the homepage" => sub { subtest "redirect x,y requests to lat/lon (301 - permanent)" => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/around?x=3281&y=1113'); }; @@ -73,8 +71,8 @@ foreach my $test ( foreach my $test ( { pc => 'SW1A 1AA', - latitude => '51.5', - longitude => '-2.1', + latitude => '51.501009', + longitude => '-0.141588', }, { pc => 'TQ 388 773', @@ -84,8 +82,6 @@ foreach my $test ( ) { subtest "check lat/lng for '$test->{pc}'" => sub { - LWP::Protocol::PSGI->register(t::Mock::MapIt->run_if_script, host => 'mapit.uk'); - $mech->get_ok('/'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], @@ -102,7 +98,7 @@ foreach my $test ( subtest 'check non public reports are not displayed on around page' => sub { my $params = { - postcode => 'EH99 1SP', + postcode => 'EH1 1BB', latitude => 55.9519637512, longitude => -3.17492254484, }; @@ -112,9 +108,9 @@ subtest 'check non public reports are not displayed on around page' => sub { $mech->get_ok('/'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP' } }, + $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } }, "good location" ); }; $mech->content_contains( 'Around page Test 3 for 2651', @@ -126,9 +122,9 @@ subtest 'check non public reports are not displayed on around page' => sub { $mech->get_ok('/'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP' } }, + $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } }, "good location" ); }; $mech->content_lacks( 'Around page Test 3 for 2651', diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index 22ade6f4b..3a11cfc4a 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -56,6 +56,10 @@ for my $test ( is_deeply $mech->page_errors, [ $error_message ], 'errors match'; } +# Email address parsing should pass from here +my $resolver = Test::MockModule->new('Email::Valid'); +$resolver->mock('address', sub { $_[1] }); + # create a new account $mech->clear_emails_ok; $mech->get_ok('/auth'); diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index f3eae32a7..09fdf22d3 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -1,13 +1,13 @@ use strict; use warnings; use Test::More; +use Test::MockModule; use LWP::Protocol::PSGI; use LWP::Simple; use JSON::MaybeXS; use t::Mock::Facebook; use t::Mock::Twitter; -use t::Mock::MapIt; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -18,8 +18,6 @@ END { FixMyStreet::App->log->enable('info'); } my ($report) = $mech->create_problems_for_body(1, '2345', 'Test'); -LWP::Protocol::PSGI->register(t::Mock::MapIt->to_psgi_app, host => 'mapit.uk'); - FixMyStreet::override_config { FACEBOOK_APP_ID => 'facebook-app-id', TWITTER_KEY => 'twitter-key', @@ -30,6 +28,9 @@ FixMyStreet::override_config { my $fb_email = 'facebook@example.org'; my $fb_uid = 123456789; +my $resolver = Test::MockModule->new('Email::Valid'); +$resolver->mock('address', sub { 'facebook@example.org' }); + for my $fb_state ( 'refused', 'no email', 'existing UID', 'okay' ) { for my $page ( 'my', 'report', 'update' ) { subtest "test FB '$fb_state' login for page '$page'" => sub { @@ -138,6 +139,8 @@ for my $fb_state ( 'refused', 'no email', 'existing UID', 'okay' ) { } } +$resolver->mock('address', sub { 'twitter@example.org' }); + my $tw_email = 'twitter@example.org'; my $tw_uid = 987654321; diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 5ea5cb9f5..903affdcf 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -25,7 +25,7 @@ my $p_user = $mech->create_user_ok('p_user@example.com'); set_absolute_time('2014-03-01T12:00:00'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->not_logged_in_ok; @@ -48,7 +48,7 @@ FixMyStreet::override_config { with_fields => { email => $test_user, password_sign_in => $test_pass } } ); - $mech->content_contains( 'City of Edinburgh' ); + $mech->content_contains( 'Area 2651' ); FixMyStreet::App->model('DB::Contact')->search( { body_id => $body->id } ) ->delete; diff --git a/t/app/controller/index.t b/t/app/controller/index.t index 6752d4d7e..6b28a03d2 100644 --- a/t/app/controller/index.t +++ b/t/app/controller/index.t @@ -12,12 +12,7 @@ subtest "check that the form goes to /around" => sub { $mech->get_ok('/'); is $mech->uri->path, '/', "still on '/'"; - # submit form - FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', - }, sub { - $mech->submit_form_ok( { with_fields => { pc => 'SW1A 1AA', } } ); - }; + $mech->submit_form_ok( { with_fields => { pc => 'SW1A 1AA', } } ); # check that we are at /around is $mech->uri->path, '/around', "Got to /around"; @@ -52,7 +47,7 @@ subtest "does pc, (x,y), (e,n) or (lat,lon) go to /around" => sub { # get the uri and check for 302 FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok($uri); }; diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t index 69c2ae866..ad857b5e3 100644 --- a/t/app/controller/photo.t +++ b/t/app/controller/photo.t @@ -30,7 +30,7 @@ subtest "Check multiple upload worked" => sub { # submit initial pc form FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', UPLOAD_DIR => $UPLOAD_DIR, }, sub { diff --git a/t/app/controller/report_as_other.t b/t/app/controller/report_as_other.t index b4405be57..551a59481 100644 --- a/t/app/controller/report_as_other.t +++ b/t/app/controller/report_as_other.t @@ -1,9 +1,7 @@ use strict; use warnings; use Test::More; -use LWP::Protocol::PSGI; -use t::Mock::MapIt; use FixMyStreet::TestMech; use FixMyStreet::App; @@ -13,7 +11,7 @@ END { FixMyStreet::App->log->enable('info'); } my $mech = FixMyStreet::TestMech->new; -my $body = $mech->create_body_ok(2245, 'Wiltshire Council'); +my $body = $mech->create_body_ok(2237, 'Oxfordshire County Council'); my $contact1 = $mech->create_contact_ok( body_id => $body->id, category => 'Street lighting', email => 'highways@example.com' ); my $contact2 = $mech->create_contact_ok( body_id => $body->id, category => 'Potholes', email => 'potholes@example.com' ); @@ -38,7 +36,7 @@ subtest "Body user, has permission to add report as council" => sub { detail => 'Test report details.', category => 'Street lighting', ); - is $report->name, 'Wiltshire Council', 'report name is body'; + is $report->name, 'Oxfordshire County Council', 'report name is body'; is $report->user->name, 'Body User', 'user name unchanged'; is $report->user->id, $user->id, 'user matches'; is $report->anonymous, 0, 'report not anonymous'; @@ -59,7 +57,7 @@ subtest "Body user, has permission to add report as another user" => sub { is $report->user->name, 'Another User', 'user name matches'; is $report->user->email, 'another@example.net', 'user email correct'; isnt $report->user->id, $user->id, 'user does not match'; - like $mech->get_text_body_from_email, qr/Your report to Wiltshire Council has been logged/; + like $mech->get_text_body_from_email, qr/Your report to Oxfordshire County Council has been logged/; push @users, $report->user; }; @@ -78,7 +76,7 @@ subtest "Body user, has permission to add report as another (existing) user" => is $report->user->name, 'Existing User', 'user name remains same'; is $report->user->email, 'existing@example.net', 'user email correct'; isnt $report->user->id, $user->id, 'user does not match'; - like $mech->get_text_body_from_email, qr/Your report to Wiltshire Council has been logged/; + like $mech->get_text_body_from_email, qr/Your report to Oxfordshire County Council has been logged/; push @users, $report->user; }; @@ -88,7 +86,7 @@ subtest "Body user, has permission to add update as council" => sub { form_as => 'body', update => 'Test Update', ); - is $update->name, 'Wiltshire Council', 'update name is body'; + is $update->name, 'Oxfordshire County Council', 'update name is body'; is $update->user->name, 'Body User', 'user name unchanged'; is $update->user->id, $user->id, 'user matches'; is $update->anonymous, 0, 'update not anonymous'; @@ -134,7 +132,6 @@ END { sub start_report { my $permission = shift; - LWP::Protocol::PSGI->register(t::Mock::MapIt->run_if_script, host => 'mapit.uk'); $_->delete for $user->user_body_permissions; $user->user_body_permissions->create({ body => $body, permission_type => $permission }) if $permission; diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t index 6c0da221c..b956b61ae 100644 --- a/t/app/controller/report_import.t +++ b/t/app/controller/report_import.t @@ -1,13 +1,15 @@ use strict; use warnings; use Test::More; -use LWP::Protocol::PSGI; -use t::Mock::MapIt; use FixMyStreet::TestMech; use FixMyStreet::App; use Web::Scraper; use Path::Class; +use LWP::Protocol::PSGI; +use t::Mock::MapItZurich; + +LWP::Protocol::PSGI->register(t::Mock::MapItZurich->to_psgi_app, host => 'mapit.zurich'); my $mech = FixMyStreet::TestMech->new; $mech->get_ok('/import'); @@ -92,8 +94,6 @@ subtest "Test creating bad partial entries" => sub { }; subtest "Submit a correct entry" => sub { - LWP::Protocol::PSGI->register(t::Mock::MapIt->run_if_script, host => 'mapit.uk'); - $mech->get_ok('/import'); $mech->submit_form_ok( # @@ -259,7 +259,7 @@ subtest "Submit a correct entry (with location)" => sub { # go to the token url FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok($token_url); }; @@ -285,7 +285,7 @@ subtest "Submit a correct entry (with location)" => sub { # change the details FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( # { @@ -318,7 +318,7 @@ subtest "Submit a correct entry (with location)" => sub { subtest "Submit a correct entry (with location) to cobrand" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'zurich' ], - MAPIT_URL => 'http://global.mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.zurich/', MAPIT_TYPES => [ 'O08' ], MAPIT_ID_WHITELIST => [], MAP_TYPE => 'Zurich,OSM', diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index cc98f2b64..69e43ad99 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -34,7 +34,7 @@ my $user = $mech->log_in_ok('test@example.com'); $user->update( { from_body => $oxon } ); FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => 'fixmystreet', }, sub { subtest "test inspect page" => sub { @@ -177,7 +177,6 @@ FixMyStreet::override_config { }; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', ALLOWED_COBRANDS => 'oxfordshire', }, sub { subtest "test negative reputation" => sub { @@ -215,7 +214,6 @@ FixMyStreet::override_config { }; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', ALLOWED_COBRANDS => [ 'oxfordshire', 'fixmystreet' ], BASE_URL => 'http://fixmystreet.site', }, sub { diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index c4dd30e47..fd3108438 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -25,7 +25,7 @@ subtest "test that bare requests to /report/new get redirected" => sub { is_deeply { $mech->uri->query_form }, {}, "query empty"; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/report/new?pc=SW1A%201AA'); }; @@ -476,7 +476,7 @@ foreach my $test ( # submit initial pc form FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } }, "submit location" ); @@ -549,7 +549,7 @@ foreach my $test ( $mech->get_ok('/around'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); @@ -665,7 +665,7 @@ subtest "test password errors for a user who is signing in as they report" => su $mech->get_ok('/around'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); @@ -717,7 +717,7 @@ subtest "test report creation for a user who is signing in as they report" => su $mech->get_ok('/around'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); @@ -813,7 +813,7 @@ foreach my $test ( $mech->get_ok('/around'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } }, "submit location" ); @@ -912,7 +912,7 @@ subtest "test report creation for a category that is non public" => sub { $mech->get_ok('/around'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); @@ -974,7 +974,7 @@ $contact2->update; my $extra_details; FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=' . $saved_lat . '&longitude=' . $saved_lon ); }; @@ -983,7 +983,7 @@ ok !$extra_details->{titles_list}, 'Non Bromley does not send back list of title FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $extra_details = $mech->get_ok_json( '/report/new/ajax?latitude=51.4021&longitude=0.01578'); }; @@ -1003,7 +1003,7 @@ subtest "check that a lat/lon off coast leads to /around" => sub { my $off_coast_longitude = -0.646929; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok( # "/report/new" @@ -1025,7 +1025,7 @@ for my $test ( { desc => 'user title not set if not bromley problem', host => 'www.fixmystreet.com', - postcode => 'EH99 1SP', + postcode => 'EH1 1BB', fms_extra_title => '', extra => [], user_title => undef, @@ -1076,7 +1076,7 @@ for my $test ( subtest $test->{desc} => sub { my $override = { ALLOWED_COBRANDS => [ $test->{host} =~ /bromley/ ? 'bromley' : 'fixmystreet' ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }; $mech->host( $test->{host} ); @@ -1193,9 +1193,9 @@ subtest 'user title not reset if no user title in submission' => sub { $mech->get_ok('/'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP', } }, + $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" ); $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, @@ -1258,7 +1258,7 @@ subtest "test Hart" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'hart', 'fixmystreet' ], BASE_URL => 'http://www.fixmystreet.com', - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/around'); $mech->content_contains( "Hart Council" ); @@ -1434,7 +1434,7 @@ subtest "test SeeSomething" => sub { $mech->get_ok( '/around' ); FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'seesomething' ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { @@ -1481,15 +1481,15 @@ subtest "test SeeSomething" => sub { subtest "categories from deleted bodies shouldn't be visible for new reports" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { - $mech->get_ok('/report/new/ajax?latitude=51.89&longitude=-2.09'); # Cheltenham + $mech->get_ok('/report/new/ajax?latitude=51.896268&longitude=-2.093063'); # Cheltenham ok $mech->content_contains( $contact3->category ); # Delete the body which the contact belongs to. $contact3->body->update( { deleted => 1 } ); - $mech->get_ok('/report/new/ajax?latitude=51.89&longitude=-2.09'); # Cheltenham + $mech->get_ok('/report/new/ajax?latitude=51.896268&longitude=-2.093063'); # Cheltenham ok $mech->content_lacks( $contact3->category ); $contact3->body->update( { deleted => 0 } ); @@ -1499,12 +1499,12 @@ subtest "categories from deleted bodies shouldn't be visible for new reports" => subtest "unresponsive body handling works" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { # Test body-level send method my $old_send = $contact1->body->send_method; $contact1->body->update( { send_method => 'Refused' } ); - $mech->get_ok('/report/new/ajax?latitude=55.9&longitude=-3.2'); # Edinburgh + $mech->get_ok('/report/new/ajax?latitude=55.952055&longitude=-3.189579'); # Edinburgh my $body_id = $contact1->body->id; ok $mech->content_like( qr{Edinburgh.*accept reports.*/unresponsive\?body=$body_id} ); @@ -1553,8 +1553,8 @@ subtest "unresponsive body handling works" => sub { phone => '07903 123 456', category => 'Trees', service => 'iOS', - lat => 55.9, - lon => -3.2, + lat => 55.952055, + lon => -3.189579, pc => '', used_map => '1', submit_register => '1', @@ -1580,7 +1580,7 @@ subtest "unresponsive body handling works" => sub { # And test per-category refusing my $old_email = $contact3->email; $contact3->update( { email => 'REFUSED' } ); - $mech->get_ok('/report/new/category_extras?category=Trees&latitude=51.89&longitude=-2.09'); + $mech->get_ok('/report/new/category_extras?category=Trees&latitude=51.896268&longitude=-2.093063'); ok $mech->content_like( qr/Cheltenham.*Trees.*unresponsive.*category=Trees/ ); $mech->get_ok('/around'); @@ -1614,7 +1614,6 @@ subtest "unresponsive body handling works" => sub { subtest "unresponsive body page works" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', }, sub { my $old_send = $contact1->body->send_method; my $body_id = $contact1->body->id; @@ -1641,7 +1640,7 @@ subtest "extra google analytics code displayed on logged in problem creation" => FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], BASE_URL => 'https://www.fixmystreet.com', - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { # check that the user does not exist my $test_email = 'test-2@example.com'; @@ -1670,7 +1669,7 @@ subtest "extra google analytics code displayed on logged in problem creation" => $mech->submit_form_ok( { with_fields => { - title => "Test Report at café", + title => "Test Report at café", detail => 'Test report details.', photo1 => '', name => 'Joe Bloggs', @@ -1697,7 +1696,7 @@ subtest "extra google analytics code displayed on email confirmation problem cre FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], BASE_URL => 'https://www.fixmystreet.com', - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->log_out_ok; $mech->clear_emails_ok; diff --git a/t/app/controller/report_new_mobile.t b/t/app/controller/report_new_mobile.t index 61cb14a1b..3dfb99b2f 100644 --- a/t/app/controller/report_new_mobile.t +++ b/t/app/controller/report_new_mobile.t @@ -1,5 +1,7 @@ use Test::More; use FixMyStreet::TestMech; +use LWP::Protocol::PSGI; +use t::Mock::MapItZurich; my $mech = FixMyStreet::TestMech->new; @@ -7,10 +9,12 @@ my $mech = FixMyStreet::TestMech->new; FixMyStreet::App->log->disable('info'); END { FixMyStreet::App->log->enable('info'); } +LWP::Protocol::PSGI->register(t::Mock::MapItZurich->to_psgi_app, host => 'mapit.zurich'); + subtest "Check signed up for alert when logged in" => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://global.mapit.mysociety.org', - MAPIT_TYPES => [ 'O06' ], + MAPIT_URL => 'http://mapit.zurich', + MAPIT_TYPES => [ 'O08' ], }, sub { $mech->log_in_ok('user@example.org'); $mech->post_ok( '/report/new/mobile', { diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t index a5b742783..e3a464f88 100644 --- a/t/app/controller/report_new_open311.t +++ b/t/app/controller/report_new_open311.t @@ -12,7 +12,7 @@ END { FixMyStreet::App->log->enable('info'); } my $mech = FixMyStreet::TestMech->new; -my $body = $mech->create_body_ok(2651, 'City of Edinburgh Council'); +my $body = $mech->create_body_ok(2245, 'Wiltshire Council'); $body->update({ endpoint => 'http://example.com/open311', jurisdiction => 'mySociety', @@ -27,7 +27,7 @@ my $contact1 = $mech->create_contact_ok( extra => [ { description => 'Lamppost number', code => 'number', required => 'True' }, { description => 'Lamppost type', code => 'type', required => 'False', values => { value => [ { name => ['Gas'], key => ['old'] }, { name => [ 'Yellow' ], key => [ 'modern' ] } ] } - } + } ], ); my $contact1b = $mech->create_contact_ok( @@ -117,7 +117,7 @@ foreach my $test ( # submit initial pc form FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => { pc => $test->{pc} } }, "submit location" ); @@ -158,7 +158,7 @@ foreach my $test ( }; FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->submit_form_ok( { with_fields => $new_values } ); }; diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 8fa03897b..a21d3ad65 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -107,7 +107,7 @@ is $stats->{'Fife Council'}->[4], 3, 'correct number of fixed reports for Fife'; is $stats->{'Fife Council'}->[5], 1, 'correct number of older fixed reports for Fife'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); $mech->get_ok('/reports/Westminster'); @@ -121,7 +121,7 @@ my $problems = $mech->extract_problem_list; is scalar @$problems, 5, 'correct number of problems displayed'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports'); $mech->follow_link_ok({ url_regex => qr{/reports/Electricity_Gas\+Council} }); @@ -133,7 +133,7 @@ $problems = $mech->extract_problem_list; is scalar @$problems, 2, 'correct number of new problems displayed'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/City+of+Edinburgh?t=older'); }; @@ -169,7 +169,7 @@ for my $test ( ) { subtest $test->{desc} => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/Fife+Council?t=' . $test->{type}); }; @@ -183,7 +183,7 @@ my $private = $westminster_problems[2]; ok $private->update( { non_public => 1 } ), 'problem marked non public'; FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok('/reports/Westminster'); }; @@ -213,7 +213,7 @@ subtest "test fiksgatami all reports page" => sub { subtest "test greenwich all reports page" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'greenwich' ], - MAPIT_URL => 'http://mapit.mysociety.org/' + MAPIT_URL => 'http://mapit.uk/' }, sub { my $body = $mech->create_body_ok(2493, 'Royal Borough of Greenwich'); my $deleted_contact = $mech->create_contact_ok( @@ -235,7 +235,7 @@ subtest "test greenwich all reports page" => sub { subtest "it lists shortlisted reports" => sub { FixMyStreet::override_config { - MAPIT_URL => 'http://mapit.mysociety.org/' + MAPIT_URL => 'http://mapit.uk/' }, sub { my $body = FixMyStreet::App->model('DB::Body')->find( $body_edin_id ); my $user = $mech->log_in_ok( 'test@example.com' ); diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index 4f737dda7..bec504760 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -44,7 +44,7 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { $mech->host('www.fixmystreet.com'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'fixmystreet' ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok("/rss/pc/EH11BB/2"); }; @@ -118,7 +118,7 @@ $report->update(); FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'fixmystreet' ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok("/rss/pc/EH11BB/2"); }; @@ -186,7 +186,7 @@ subtest "check RSS feeds on cobrand have correct URLs for non-cobrand reports" = FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'hart' ], - MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_URL => 'http://mapit.uk/', }, sub { $mech->get_ok("/rss/area/Hart"); my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('hart')->new(); |