aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--t/Mock/MapItZurich.pm6
-rw-r--r--t/cobrand/zurich.t15
3 files changed, 21 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 3782063d5..bbdf449aa 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1377,7 +1377,7 @@ sub user_edit : Path('user_edit') : Args(1) {
}
if ( $user->from_body ) {
- unless ( $c->stash->{body} && $user->from_body->id eq $c->stash->{body}->id ) {
+ unless ( $c->stash->{live_contacts} ) {
$c->stash->{body} = $user->from_body;
$c->forward('fetch_contacts');
}
diff --git a/t/Mock/MapItZurich.pm b/t/Mock/MapItZurich.pm
index ece9a9b22..9195749f6 100644
--- a/t/Mock/MapItZurich.pm
+++ b/t/Mock/MapItZurich.pm
@@ -38,6 +38,12 @@ sub dispatch_request {
my $json = $self->json->encode({});
return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
},
+
+ sub (GET + /area/*/children) {
+ my ($self, $area) = @_;
+ my $json = $self->json->encode({});
+ return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
+ },
}
__PACKAGE__->run_if_script;
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index b59e546dd..ddaae1f90 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -102,8 +102,9 @@ sub get_export_rows_count {
my $EXISTING_REPORT_COUNT = 0;
+my $superuser;
subtest "set up superuser" => sub {
- my $superuser = $mech->log_in_ok( 'super@example.org' );
+ $superuser = $mech->log_in_ok( 'super@example.org' );
# a user from body $zurich is a superuser, as $zurich has no parent id!
$superuser->update({ from_body => $zurich->id });
$EXISTING_REPORT_COUNT = get_export_rows_count($mech);
@@ -968,6 +969,18 @@ subtest 'time_spent' => sub {
$mech->log_out_ok;
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ MAPIT_URL => 'http://mapit.zurich/',
+ MAPIT_TYPES => [ 'ZZZ' ],
+}, sub {
+ LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
+ subtest 'users at the top level can be edited' => sub {
+ $mech->log_in_ok( $superuser->email );
+ $mech->get_ok('/admin/user_edit/' . $superuser->id );
+ };
+};
+
END {
$mech->delete_body($subdivision);
$mech->delete_body($division);