Skip to content

Commit

Permalink
[Northumberland] Add feature_id for street lights.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Oct 27, 2023
1 parent 4f22cc2 commit db26559
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Open311::Endpoint::Integration::UK::NorthumberlandAlloy - Northumberland-specifi

package Open311::Endpoint::Integration::UK::NorthumberlandAlloy;

use List::Util qw(any);
use Moo;
extends 'Open311::Endpoint::Integration::AlloyV2';

Expand All @@ -21,6 +22,24 @@ sub service_request_content {
'/open311/service_request_extended'
}

sub services {
my $self = shift;

my @services = $self->SUPER::services;
foreach (@services) {
if (any { $_ eq 'Street Lighting' } @{$_->groups}) {
push @{$_->attributes}, Open311::Endpoint::Service::Attribute->new(
code => 'feature_id',
description => 'Feature ID',
datatype => 'string',
required => 0,
automated => 'hidden_field',
);
}
}
return @services;
}

=head2 process_attributes
In addition to the default new request processing, this function:
Expand Down
8 changes: 8 additions & 0 deletions t/open311/endpoint/northumberland_alloy.t
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ subtest "check service group and category aliases" => sub {
is $row_service->{service_name}, "nuisance/dangerous animal", "category alias applied to row service";
};

subtest "check street light service has additional attribute" => sub {
my $res = $endpoint->run_test_request(
GET => '/services/Obscured_by_vegetation_or_Dirty.json?jurisdiction_id=dummy',
);
my $service = (decode_json($res->content))[0];
is $service->{attributes}[-1]{code}, 'feature_id';
};

subtest "create problem on aliased group" => sub {
set_fixed_time('2023-02-21T13:37:00Z');
my $res = $endpoint->run_test_request(
Expand Down

0 comments on commit db26559

Please sign in to comment.