aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Mock/MapIt.pm5
-rw-r--r--t/cobrand/tfl.t16
2 files changed, 21 insertions, 0 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 3b36b52f4..96be429e4 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -119,6 +119,11 @@ sub dispatch_request {
$self->output({2650 => {parent_area => undef, id => 2650, name => "Aberdeen Council", type => "UTA"}});
} elsif ($areas eq 'GRE') {
$self->output({2493 => {parent_area => undef, id => 2493, name => "Greenwich Borough Council", type => "LBO"}});
+ } elsif ($areas eq 'LBO') {
+ $self->output({
+ 2482 => {parent_area => undef, id => 2482, name => "Bromley Borough Council", type => "LBO"},
+ 2483 => {parent_area => undef, id => 2483, name => "Hounslow Borough Council", type => "LBO"},
+ });
} elsif ($areas eq 60705) {
$self->output({60705 => {parent_area => 2245, id => 60705, name => "Trowbridge", type => "CPC"}});
}
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index bb074a872..c7db294ac 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -9,6 +9,7 @@ END { FixMyStreet::App->log->enable('info'); }
my $mech = FixMyStreet::TestMech->new;
my $body = $mech->create_body_ok(2482, 'TfL');
+my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1);
my $staffuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $body);
$staffuser->user_body_permissions->create({
body => $body,
@@ -155,6 +156,21 @@ subtest 'check report age on /around' => sub {
$mech->content_lacks($report->title);
};
+subtest 'TfL admin allows inspectors to be assigned to borough areas' => sub {
+ $mech->log_in_ok($superuser->email);
+
+ $mech->get_ok("/admin/users/" . $staffuser->id) or diag $mech->content;
+
+ $mech->submit_form_ok( { with_fields => {
+ area_ids => [2482],
+ } } );
+
+ $staffuser->discard_changes;
+ is_deeply $staffuser->area_ids, [2482], "User assigned to Bromley LBO area";
+
+ $staffuser->update({ area_ids => undef}); # so login below doesn't break
+};
+
subtest 'TfL staff can access TfL admin' => sub {
$mech->log_in_ok( $staffuser->email );
$mech->get_ok('/admin');