-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bromley] Allow reporting on 3 assets outside Bromley area
- Loading branch information
1 parent
097b453
commit 788fb35
Showing
4 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,14 @@ LWP::Protocol::PSGI->register($tilma->to_psgi_app, host => 'tilma.mysociety.org' | |
|
||
# Create test data | ||
my $user = $mech->create_user_ok( '[email protected]', name => 'Bromley' ); | ||
my $standard_user = $mech->create_user_ok('[email protected]', name => 'Bob Betts'); | ||
my $body = $mech->create_body_ok( 2482, 'Bromley Council', { | ||
can_be_devolved => 1, send_extended_statuses => 1, comment_user => $user, | ||
send_method => 'Open311', endpoint => 'http://endpoint.example.com', jurisdiction => 'FMS', api_key => 'test', send_comments => 1 | ||
}, { | ||
cobrand => 'bromley' | ||
}); | ||
my $lewisham = $mech->create_body_ok( 2492, 'Lewisham Borough Council'); | ||
my $staffuser = $mech->create_user_ok( '[email protected]', name => 'Staffie', from_body => $body ); | ||
my $role = FixMyStreet::DB->resultset("Role")->create({ | ||
body => $body, name => 'Role A', permissions => ['moderate', 'user_edit', 'report_mark_private', 'report_inspect', 'contribute_as_body'] }); | ||
|
@@ -46,7 +48,17 @@ $contact->set_extra_fields( | |
{ code => 'service_request_id_ext', datatype => 'number', }, | ||
); | ||
$contact->update; | ||
my $tfl = $mech->create_body_ok( 2482, 'TfL'); | ||
my $streetlights = $mech->create_contact_ok( | ||
body_id => $body->id, | ||
category => 'Streetlights', | ||
email => 'LIGHT', | ||
); | ||
$streetlights->set_extra_fields( | ||
{ code => 'feature_id', datatype => 'string', automated => 'hidden_field' }, | ||
); | ||
$streetlights->update; | ||
|
||
my $tfl = $mech->create_body_ok( 2482, 'TfL', {}, { cobrand => 'tfl' }); | ||
$mech->create_contact_ok( | ||
body_id => $tfl->id, | ||
category => 'Traffic Lights', | ||
|
@@ -612,4 +624,51 @@ for my $test ( | |
}; | ||
} | ||
|
||
subtest 'Can select asset that is in Lewisham area on Bromley Cobrand' => sub { | ||
FixMyStreet::override_config { | ||
ALLOWED_COBRANDS => ['bromley', 'tfl'], | ||
MAPIT_URL => 'http://mapit.uk/', | ||
}, sub { | ||
$mech->log_in_ok('[email protected]'); | ||
$mech->get_ok('/report/new/?longitude=0.005357&latitude=51.418776'); | ||
$mech->content_contains('That location is not covered by Bromley Council', 'Area in Lewisham not reportable on Bromley cobrand'); | ||
$mech->get_ok('/report/new/?longitude=-0.071410&latitude=51.419275&category=Streetlights'); | ||
$mech->submit_form_ok( { with_fields => { | ||
title => 'Lamp issue in Lewisham on Bromley', | ||
detail => 'Lamp issue over the border', | ||
feature_id => 'A-48-24', | ||
longitude => 0.005357, | ||
latitude => 51.418776, | ||
fms_extra_title => 'Mr' | ||
}}, 'Location in Lewisham ok as clicked from Bromley location onto Bromley asset'); | ||
my $problem = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; | ||
is $problem->title, 'Lamp issue in Lewisham on Bromley', 'Report has been made'; | ||
is $problem->body, 'Bromley Council', 'Problem on correct body'; | ||
}; | ||
}; | ||
|
||
subtest 'Can select asset that is in Lewisham area on FMS' => sub { | ||
FixMyStreet::override_config { | ||
ALLOWED_COBRANDS => ['fixmystreet', 'tfl'], | ||
MAPIT_URL => 'http://mapit.uk/', | ||
}, sub { | ||
$mech->log_in_ok('[email protected]'); | ||
$mech->get_ok('/report/new/?longitude=0.005357&latitude=51.418776'); | ||
$mech->content_contains('We do not yet have details for the council that covers this location', 'Lewisham does not have Bromley categories'); | ||
$mech->get_ok('/report/new/?longitude=-0.071410&latitude=51.419275&category=Streetlights'); | ||
$mech->submit_form_ok( { with_fields => { | ||
title => 'Lamp issue in Lewisham on FMS', | ||
detail => 'Lamp issue over the border', | ||
feature_id => 'A-48-26', | ||
longitude => 0.005357, | ||
latitude => 51.418776, | ||
fms_extra_title => 'Mr' | ||
}}, 'Location in Lewisham ok as clicked from Bromley location onto Bromley asset'); | ||
my $problem = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; | ||
is $problem->title, 'Lamp issue in Lewisham on FMS', 'Report has been made'; | ||
is $problem->body, 'Bromley Council', 'Problem on correct body'; | ||
}; | ||
}; | ||
|
||
|
||
done_testing(); |