aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Bristol.pm2
-rw-r--r--t/Mock/MapIt.pm1
-rw-r--r--t/cobrand/bristol.t44
3 files changed, 46 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bristol.pm b/perllib/FixMyStreet/Cobrand/Bristol.pm
index 2876ff782..b11a52643 100644
--- a/perllib/FixMyStreet/Cobrand/Bristol.pm
+++ b/perllib/FixMyStreet/Cobrand/Bristol.pm
@@ -68,7 +68,7 @@ sub categories_restriction {
# cobrand, not the email categories from FMS.com. We've set up the
# Email categories with a devolved send_method, so can identify Open311
# categories as those which have a blank send_method.
- return $rs->search( { send_method => undef } );
+ return $rs->search( { 'me.send_method' => undef } );
}
1;
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 24e7a8084..ad1d0c99c 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -24,6 +24,7 @@ sub output {
my @PLACES = (
[ 'EH1 1BB', 55.952055, -3.189579, 2651, 'Edinburgh City Council', 'UTA', 20728, 'City Centre', 'UTE' ],
+ [ 'BS10 5EE', 51.494885, -2.602237, 2561, 'Bristol City Council', 'UTA', 148646, 'Bedminster', 'UTW' ],
[ 'SW1A 1AA', 51.501009, -0.141588, 2504, 'Westminster City Council', 'LBO' ],
[ 'GL50 2PR', 51.896268, -2.093063, 2226, 'Gloucestershire County Council', 'CTY', 2326, 'Cheltenham Borough Council', 'DIS', 4544, 'Lansdown', 'DIW', 143641, 'Lansdown and Park', 'CED' ],
[ '?', 51.754926, -1.256179, 2237, 'Oxfordshire County Council', 'CTY', 2421, 'Oxford City Council', 'DIS' ],
diff --git a/t/cobrand/bristol.t b/t/cobrand/bristol.t
new file mode 100644
index 000000000..b4b6ed4ac
--- /dev/null
+++ b/t/cobrand/bristol.t
@@ -0,0 +1,44 @@
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+# Create test data
+my $body = $mech->create_body_ok( 2561, 'Bristol County Council', {
+ send_method => 'Open311',
+ can_be_devolved => 1
+});
+
+my $open311_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Street Lighting',
+ email => 'LIGHT',
+);
+my $email_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Potholes',
+ email => 'potholes@example.org',
+ send_method => 'Email'
+);
+
+subtest 'Only Open311 categories are shown on Bristol cobrand', sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'bristol' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->get_ok("/report/new/ajax?latitude=51.494885&longitude=-2.602237");
+ $mech->content_contains($open311_contact->category);
+ $mech->content_lacks($email_contact->category);
+ };
+};
+
+subtest 'All categories are shown on FMS cobrand', sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->get_ok("/report/new/ajax?latitude=51.494885&longitude=-2.602237");
+ $mech->content_contains($open311_contact->category);
+ $mech->content_contains($email_contact->category);
+ };
+};
+
+done_testing();