diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 1 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 87012dff8..9c07eb0bb 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -38,6 +38,7 @@ The entries will be something like this (but with different ids). Users: id | email | from_body ----+------------------+----------- + 1 | super@example.org| 1 2 | dm1@example.org | 2 3 | sdm1@example.org | 3 diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index a77363621..0cb4e36cf 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -405,6 +405,29 @@ like $email->body, qr/test\@example.com/, 'body does contain email address'; $mech->clear_emails_ok; $mech->log_out_ok; +subtest "only superuser can see stats" => sub { + $user = $mech->log_in_ok( 'super@example.org' ); + # a user from body $zurich is a superuser, as $zurich has no parent id! + $user->update({ from_body => $zurich->id }); + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'zurich' ], + }, sub { + $mech->get( '/admin/stats' ); + }; + is $mech->res->code, 200, "superuser should be able to see stats page"; + $mech->log_out_ok; + + $user = $mech->log_in_ok( 'dm1@example.org' ); + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'zurich' ], + }, sub { + $mech->get( '/admin/stats' ); + }; + is $mech->res->code, 404, "only superuser should be able to see stats page"; + $mech->log_out_ok; +}; + subtest "only superuser can edit bodies" => sub { $user = $mech->log_in_ok( 'dm1@example.org' ); FixMyStreet::override_config { @@ -509,6 +532,22 @@ subtest "hidden report email are only sent when requested" => sub { }; }; +subtest "test stats" => sub { + $user = $mech->log_in_ok( 'super@example.org' ); + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'zurich' ], + }, sub { + $mech->get( '/admin/stats' ); + }; + is $mech->res->code, 200, "superuser should be able to see stats page"; + + $mech->content_contains('Innerhalb eines Arbeitstages moderiert: 1'); + $mech->content_contains('Innerhalb von fünf Arbeitstagen abgeschlossen: 1'); + + $mech->log_out_ok; +}; + $mech->delete_problems_for_body( 2 ); $mech->delete_user( 'dm1@example.org' ); $mech->delete_user( 'sdm1@example.org' ); |