aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-06-26 18:18:56 +0100
committerMatthew Somerville <matthew@mysociety.org>2018-06-28 13:35:23 +0100
commitdadddc42f5e5c4b3a02db9171a485885b1e365a7 (patch)
tree603a745179c5b141211ccb6355fcbeaf7ecaeb95 /t/cobrand
parent53f3af1fd561d852346902a06ef27c110d0bd2c1 (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/cobrand')
-rw-r--r--t/cobrand/fiksgatami.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/cobrand/fiksgatami.t b/t/cobrand/fiksgatami.t
new file mode 100644
index 000000000..6510f5ebe
--- /dev/null
+++ b/t/cobrand/fiksgatami.t
@@ -0,0 +1,30 @@
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+my $oslo = $mech->create_body_ok(3, 'Oslo');
+my $vestfold = $mech->create_body_ok(7, 'Vestfold');
+my $larvik = $mech->create_body_ok(709, 'Larvik');
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'fiksgatami',
+ MAPIT_URL => 'http://mapit.uk/',
+ GEOCODER => '',
+}, sub {
+ $mech->get_ok('/alert/list?pc=0045');
+ $mech->content_contains('rss/l/59.9,10.9/2');
+ $mech->content_contains('/rss/reports/Oslo');
+ $mech->content_contains('council:' . $oslo->id . ':Oslo');
+
+ $mech->get_ok('/alert/list?pc=3290');
+ $mech->content_contains('rss/l/59,10/5');
+ $mech->content_contains('/rss/area/Larvik');
+ $mech->content_contains('/rss/area/Vestfold');
+ $mech->content_contains('/rss/reports/Larvik');
+ $mech->content_contains('/rss/reports/Vestfold');
+ $mech->content_contains('area:7:Vestfold');
+ $mech->content_contains('area:709:Larvik');
+ $mech->content_contains('council:' . $vestfold->id . ':Vestfold');
+ $mech->content_contains('council:' . $larvik->id . ':Larvik');
+};
+
+done_testing();