diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-06-26 18:18:56 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2018-06-28 13:35:23 +0100 |
commit | dadddc42f5e5c4b3a02db9171a485885b1e365a7 (patch) | |
tree | 603a745179c5b141211ccb6355fcbeaf7ecaeb95 /t/app/controller/alert.t | |
parent | 53f3af1fd561d852346902a06ef27c110d0bd2c1 (diff) |
[UK] Fix issue when body ID not equal to MapIt ID.
Hitherto when creating a body or ward alert on a UK site,
the MapIt area ID has been stored instead of the body ID.
This is okay for www.fixmystreet.com which for historical
reasons does have body IDs that match MapIt area IDs, but
other UK-based sites may well not. The alert lookup looks
for body ID, meaning those alerts will not work. Save the
body ID instead, plus fix some tests that were making the
same assumption.
Diffstat (limited to 't/app/controller/alert.t')
-rw-r--r-- | t/app/controller/alert.t | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index 57e73e5ec..41aee5bbc 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -9,6 +9,11 @@ $mech->title_like(qr/^Local RSS feeds and email alerts/); $mech->content_contains('Local RSS feeds and email alerts'); $mech->content_contains('html class="no-js" lang="en-gb"'); +my $body = $mech->create_body_ok(2651, 'Edinburgh'); +$mech->create_body_ok(2504, 'Birmingham City Council'); +$mech->create_body_ok(2226, 'Gloucestershire County Council'); +$mech->create_body_ok(2326, 'Cheltenham Borough Council'); + # check that we can get list page FixMyStreet::override_config { ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ], @@ -33,8 +38,8 @@ FixMyStreet::override_config { $mech->content_contains('Problems within City Centre ward'); $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'); + $mech->content_contains('council:' . $body->id . ':Edinburgh'); + $mech->content_contains('ward:' . $body->id . ':20728:Edinburgh:City_Centre'); subtest "Test Nominatim lookup" => sub { $mech->get_ok('/alert/list?pc=High Street'); @@ -49,16 +54,12 @@ FixMyStreet::override_config { $mech->content_contains('Problems in an area'); $mech->content_contains('Reports by destination'); - $mech->get_ok('/alert/subscribe?rss=1&type=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy=' ); + $mech->get_ok('/alert/subscribe?rss=1&type=local&pc=EH1+1BB&rss=Give+me+an+RSS+feed&rznvy=' ); $mech->content_contains('Please select the feed you want'); - $mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=ky16+8yg&rss=Give+me+an+RSS+feed&rznvy='); + $mech->get_ok('/alert/subscribe?rss=1&feed=invalid:1000:A_Locationtype=local&pc=EH1+1BB&rss=Give+me+an+RSS+feed&rznvy='); $mech->content_contains('Illegal feed selection'); - $mech->create_body_ok(2504, 'Birmingham City Council'); - $mech->create_body_ok(2226, 'Gloucestershire County Council'); - $mech->create_body_ok(2326, 'Cheltenham Borough Council'); - $mech->get_ok('/alert/subscribe?rss=1&feed=area:1000:Birmingham'); is $mech->uri->path, '/rss/reports/Birmingham'; |