diff options
Diffstat (limited to 't')
-rw-r--r-- | t/cobrand/bexley.t | 19 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 1 | ||||
-rw-r--r-- | t/cobrand/oxfordshire.t | 44 | ||||
-rw-r--r-- | t/map/mastermap.t | 22 | ||||
-rw-r--r-- | t/map/tests.t | 2 |
5 files changed, 68 insertions, 20 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index 3cf71798e..6b618762f 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -6,7 +6,6 @@ use Catalyst::Test 'FixMyStreet::App'; use_ok 'FixMyStreet::Cobrand::Bexley'; use_ok 'FixMyStreet::Geocode::Bexley'; -use_ok 'FixMyStreet::Map::Bexley'; my $ukc = Test::MockModule->new('FixMyStreet::Cobrand::UKCouncils'); $ukc->mock('lookup_site_code', sub { @@ -43,7 +42,6 @@ $category->update; FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'bexley' ], MAPIT_URL => 'http://mapit.uk/', - MAP_TYPE => 'Bexley', STAGING_FLAGS => { send_reports => 1, skip_checks => 0 }, COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com,another@notbexley.example.com' } } }, }, sub { @@ -183,23 +181,6 @@ subtest 'nearest road returns correct road' => sub { is $cobrand->_nearest_feature($cfg, 545451, 174380, $features), '20101226'; }; -subtest 'correct map tiles used' => sub { - my %test = ( - 16 => [ '-', 'oml' ], - 20 => [ '.', 'bexley' ] - ); - foreach my $zoom (qw(16 20)) { - my $tiles = FixMyStreet::Map::Bexley->map_tiles(x_tile => 123, y_tile => 456, zoom_act => $zoom); - my ($sep, $lyr) = @{$test{$zoom}}; - is_deeply $tiles, [ - "//a${sep}tilma.mysociety.org/$lyr/$zoom/122/455.png", - "//b${sep}tilma.mysociety.org/$lyr/$zoom/123/455.png", - "//c${sep}tilma.mysociety.org/$lyr/$zoom/122/456.png", - "//tilma.mysociety.org/$lyr/$zoom/123/456.png", - ]; - } -}; - my $geo = Test::MockModule->new('FixMyStreet::Geocode'); $geo->mock('cache', sub { my $typ = shift; diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index 1d22eb517..9e1b80c68 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -104,6 +104,7 @@ subtest "only original reporter can comment" => sub { FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', ALLOWED_COBRANDS => 'isleofwight', + COBRAND_FEATURES => { updates_allowed => { isleofwight => 'reporter' } }, }, sub { $mech->get_ok('/report/' . $reports[0]->id); $mech->content_contains('Only the original reporter may leave updates'); diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t index b8422a28b..dd5eedc8d 100644 --- a/t/cobrand/oxfordshire.t +++ b/t/cobrand/oxfordshire.t @@ -1,6 +1,7 @@ use Test::MockModule; use FixMyStreet::TestMech; +use FixMyStreet::Script::Alerts; my $mech = FixMyStreet::TestMech->new; my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council'); @@ -61,6 +62,49 @@ subtest 'can use customer reference to search for reports' => sub { }; }; +my $user = $mech->create_user_ok( 'user@example.com', name => 'Test User' ); +my $user2 = $mech->create_user_ok( 'user2@example.com', name => 'Test User2' ); + +subtest 'check unable to fix label' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'oxfordshire' ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + my $problem = $problems[0]; + $problem->state( 'unable to fix' ); + $problem->update; + + my $alert = FixMyStreet::DB->resultset('Alert')->create( { + parameter => $problem->id, + alert_type => 'new_updates', + cobrand => 'oxfordshire', + user => $user, + } )->confirm; + + FixMyStreet::DB->resultset('Comment')->create( { + problem_state => 'unable to fix', + problem_id => $problem->id, + user_id => $user2->id, + name => 'User', + mark_fixed => 'f', + text => "this is an update", + state => 'confirmed', + confirmed => 'now()', + anonymous => 'f', + } ); + + + $mech->get_ok('/report/' . $problem->id); + $mech->content_contains('Investigation complete'); + + FixMyStreet::Script::Alerts::send(); + $mech->email_count_is(1); + my $email = $mech->get_email; + my $body = $mech->get_text_body_from_email($email); + like $body, qr/Investigation complete/, 'state correct in email'; + }; +}; + END { done_testing(); } diff --git a/t/map/mastermap.t b/t/map/mastermap.t new file mode 100644 index 000000000..109142379 --- /dev/null +++ b/t/map/mastermap.t @@ -0,0 +1,22 @@ +use FixMyStreet::TestMech; + +use FixMyStreet::Map::MasterMap; + +subtest 'correct map tiles used' => sub { + my %test = ( + 16 => [ '-', 'oml' ], + 20 => [ '.', 'mastermap' ] + ); + foreach my $zoom (qw(16 20)) { + my $tiles = FixMyStreet::Map::MasterMap->map_tiles(x_tile => 123, y_tile => 456, zoom_act => $zoom); + my ($sep, $lyr) = @{$test{$zoom}}; + is_deeply $tiles, [ + "//a${sep}tilma.mysociety.org/$lyr/$zoom/122/455.png", + "//b${sep}tilma.mysociety.org/$lyr/$zoom/123/455.png", + "//c${sep}tilma.mysociety.org/$lyr/$zoom/122/456.png", + "//tilma.mysociety.org/$lyr/$zoom/123/456.png", + ]; + } +}; + +done_testing(); diff --git a/t/map/tests.t b/t/map/tests.t index f1f29dc06..499447ad5 100644 --- a/t/map/tests.t +++ b/t/map/tests.t @@ -2,7 +2,6 @@ use FixMyStreet::Map; use Test::More; my $requires = { - 'Bexley' => 'map-bexley.js', 'Bing' => 'map-bing-ol.js', 'Bristol' => 'map-wmts-bristol.js', 'Bromley' => 'map-fms.js', @@ -14,6 +13,7 @@ my $requires = { 'Hounslow' => 'map-wmts-hounslow.js', 'IsleOfWight' => 'map-wmts-isleofwight.js', 'OSM' => 'OpenStreetMap.js', + 'MasterMap' => 'map-mastermap.js', 'CycleMap' => 'OpenStreetMap.js', 'MapQuest' => 'OpenStreetMap.js', 'StreetView' => 'map-streetview.js', |