aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand/bristol.t
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand/bristol.t')
-rw-r--r--t/cobrand/bristol.t66
1 files changed, 66 insertions, 0 deletions
diff --git a/t/cobrand/bristol.t b/t/cobrand/bristol.t
index b4b6ed4ac..b2b8cff13 100644
--- a/t/cobrand/bristol.t
+++ b/t/cobrand/bristol.t
@@ -1,6 +1,8 @@
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
+use Open311::PopulateServiceList;
+
# Create test data
my $body = $mech->create_body_ok( 2561, 'Bristol County Council', {
send_method => 'Open311',
@@ -41,4 +43,68 @@ subtest 'All categories are shown on FMS cobrand', sub {
};
};
+subtest 'check services override' => sub {
+ my $processor = Open311::PopulateServiceList->new();
+
+ my $meta_xml = '<?xml version="1.0" encoding="utf-8"?>
+<service_definition>
+ <service_code>LIGHT</service_code>
+ <attributes>
+ <attribute>
+ <variable>true</variable>
+ <code>easting</code>
+ <datatype>string</datatype>
+ <required>true</required>
+ <order>1</order>
+ <description>Easting</description>
+ </attribute>
+ <attribute>
+ <variable>true</variable>
+ <code>size</code>
+ <datatype>string</datatype>
+ <required>true</required>
+ <order>2</order>
+ <description>How big is the pothole</description>
+ </attribute>
+ </attributes>
+</service_definition>
+ ';
+
+ my $o = Open311->new(
+ jurisdiction => 'mysociety',
+ endpoint => 'http://example.com',
+ test_mode => 1,
+ test_get_returns => { 'services/LIGHT.xml' => $meta_xml }
+ );
+
+ $processor->_current_open311( $o );
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'bristol' ],
+ }, sub {
+ $processor->_current_body( $body );
+ };
+ $processor->_current_service( { service_code => 'LIGHT' } );
+ $processor->_add_meta_to_contact( $open311_contact );
+
+ my $extra = [ {
+ automated => 'server_set',
+ variable => 'true',
+ code => 'easting',
+ datatype => 'string',
+ required => 'true',
+ order => 1,
+ description => 'Easting',
+ }, {
+ variable => 'true',
+ code => 'size',
+ datatype => 'string',
+ required => 'true',
+ order => 2,
+ description => 'How big is the pothole',
+ } ];
+
+ $open311_contact->discard_changes;
+ is_deeply $open311_contact->get_extra_fields, $extra, 'Easting has automated set';
+};
+
done_testing();