diff options
Diffstat (limited to 't/cobrand/bexley.t')
-rw-r--r-- | t/cobrand/bexley.t | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index 352e61389..46a25d923 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -50,14 +50,17 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'bexley' ], MAPIT_URL => 'http://mapit.uk/', STAGING_FLAGS => { send_reports => 1, skip_checks => 0 }, - COBRAND_FEATURES => { open311_email => { bexley => { - p1 => 'p1@bexley', - p1confirm => 'p1confirm@bexley', - lighting => 'thirdparty@notbexley.example.com,another@notbexley.example.com', - outofhours => 'outofhours@bexley,ooh2@bexley', - flooding => 'flooding@bexley', - eh => 'eh@bexley', - } } }, + COBRAND_FEATURES => { + open311_email => { bexley => { + p1 => 'p1@bexley', + p1confirm => 'p1confirm@bexley', + lighting => 'thirdparty@notbexley.example.com,another@notbexley.example.com', + outofhours => 'outofhours@bexley,ooh2@bexley', + flooding => 'flooding@bexley', + eh => 'eh@bexley', + } }, + category_groups => { bexley => 1 }, + }, }, sub { subtest 'cobrand displays council name' => sub { @@ -144,7 +147,7 @@ FixMyStreet::override_config { subtest 'resend is disabled in admin' => sub { my $user = $mech->log_in_ok('super@example.org'); - $user->update({ from_body => $body, is_superuser => 1 }); + $user->update({ from_body => $body, is_superuser => 1, name => 'Staff User' }); $mech->get_ok('/admin/report_edit/' . $report->id); $mech->content_contains('View report on site'); $mech->content_lacks('Resend report'); @@ -199,6 +202,16 @@ FixMyStreet::override_config { ], 'Request had multiple photos'; }; + subtest 'anonymous update message' => sub { + my $report = FixMyStreet::DB->resultset("Problem")->first; + my $staffuser = $mech->create_user_ok('super@example.org'); + $mech->create_comment_for_problem($report, $report->user, 'Commenter', 'Normal update', 't', 'confirmed', 'confirmed'); + $mech->create_comment_for_problem($report, $staffuser, 'Staff user', 'Staff update', 'f', 'confirmed', 'confirmed'); + $mech->get_ok('/report/' . $report->id); + $mech->content_contains('Posted by <strong>London Borough of Bexley</strong>'); + $mech->content_contains('Posted anonymously by a non-staff user'); + }; + }; subtest 'nearest road returns correct road' => sub { @@ -253,9 +266,10 @@ subtest 'geocoder' => sub { ] }; }; -my $bex = Test::MockModule->new('FixMyStreet::Cobrand::Bexley'); -$bex->mock('get', sub { - return <<EOF +subtest 'out of hours' => sub { + my $lwp = Test::MockModule->new('LWP::UserAgent'); + $lwp->mock('get', sub { + HTTP::Response->new(200, 'OK', [], <<EOF); { "england-and-wales": { "events": [ @@ -264,9 +278,8 @@ $bex->mock('get', sub { } } EOF -}); + }); -subtest 'out of hours' => sub { my $cobrand = FixMyStreet::Cobrand::Bexley->new; set_fixed_time('2019-10-16T12:00:00Z'); is $cobrand->_is_out_of_hours(), 0, 'not out of hours in the day'; |