diff options
-rw-r--r-- | locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 1 | ||||
-rw-r--r-- | t/app/controller/auth_social.t | 9 | ||||
-rw-r--r-- | t/app/controller/dashboard.t | 14 | ||||
-rw-r--r-- | t/cobrand/bexley.t | 6 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 4 | ||||
-rw-r--r-- | t/cobrand/westminster.t | 4 | ||||
-rw-r--r-- | t/open311/post-service-request-updates.t | 2 |
9 files changed, 28 insertions, 21 deletions
diff --git a/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po b/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po index c2482b871..8cc93f3cb 100644 --- a/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po +++ b/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po @@ -4960,7 +4960,7 @@ msgstr "Die ersten zehn Treffer werden unten aufgelistet." #: templates/web/base/report/new/notes.html:4 #: templates/web/zurich/report/new/notes.html:4 msgid "We will only use your personal information in accordance with our <a href=\"%s\">privacy policy.</a>" -msgstr "Ihre persönlichen Angaben werden nur im Zusammenhang mit der Beantwortung der Meldung verwendet." +msgstr "Ihre persönlichen Angaben werden nur im Zusammenhang mit der Beantwortung der Meldung verwendet. <!-- %s -->" #: templates/web/base/questionnaire/completed-open.html:2 msgid "We’re sorry to hear the problem’s not fixed. Why not try writing to your local representatives?" diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index 5539e8bfc..0fbb8944b 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -110,7 +110,7 @@ sub open311_post_send { if ($row->category eq 'Parks and open spaces') { $p1_email = 1 if $reportType =~ /locked in a park|Wild animal/; $p1_email = 1 if $dangerous eq 'Yes' && $reportType =~ /Playgrounds|park furniture|gates are broken|Vandalism|Other/; - } else { + } elsif (!$lighting{$row->category}) { $p1_email = 1 if $dangerous eq 'Yes'; } @@ -118,8 +118,9 @@ sub open311_post_send { if ($row->category eq 'Abandoned and untaxed vehicles' || $row->category eq 'Dead animal' || $p1_email) { push @to, [ $emails->{p1}, 'Bexley P1 email' ] if $emails->{p1}; } - if ($lighting{$row->category}) { - push @to, [ $emails->{lighting}, 'FixMyStreet Bexley Street Lighting' ] if $emails->{lighting}; + if ($lighting{$row->category} && $emails->{lighting}) { + my @lighting = split /,/, $emails->{lighting}; + push @to, [ $_, 'FixMyStreet Bexley Street Lighting' ] for @lighting; } return unless @to; my $sender = FixMyStreet::SendReport::Email->new( to => \@to ); diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index cc2020b63..e8b08ef19 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -741,6 +741,7 @@ sub create_comment_for_problem { $params->{problem_state} = $problem_state; $params->{state} = $state; $params->{mark_fixed} = $problem_state && FixMyStreet::DB::Result::Problem->fixed_states()->{$problem_state} ? 1 : 0; + $params->{confirmed} = \'current_timestamp' unless $params->{confirmed} || $state eq 'unconfirmed'; FixMyStreet::App->model('DB::Comment')->create($params); } diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index f5f64248c..d0ee4e148 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -56,9 +56,12 @@ for my $test ( }, { type => 'oidc', config => { - ALLOWED_COBRANDS => [ { westminster => '.' } ], + ALLOWED_COBRANDS => 'westminster', MAPIT_URL => 'http://mapit.uk/', COBRAND_FEATURES => { + anonymous_account => { + westminster => 'test', + }, oidc_login => { westminster => { client_id => 'example_client_id', @@ -385,6 +388,4 @@ for my $tw_state ( 'refused', 'existing UID', 'no email' ) { }; -END { - done_testing(); -} +done_testing(); diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index ff8d1a9d5..061809aaf 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -46,9 +46,13 @@ my @scheduled_problems = $mech->create_problems_for_body(7, $body->id, 'Title', my @fixed_problems = $mech->create_problems_for_body(4, $body->id, 'Title', { areas => ",$area_id,2651,", category => 'Potholes', cobrand => 'fixmystreet' }); my @closed_problems = $mech->create_problems_for_body(3, $body->id, 'Title', { areas => ",$area_id,2651,", category => 'Traffic lights', cobrand => 'fixmystreet' }); +my $first_problem_id; +my $first_update_id; foreach my $problem (@scheduled_problems) { $problem->update({ state => 'action scheduled' }); - $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'action scheduled'); + my ($update) = $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'action scheduled'); + $first_problem_id = $problem->id unless $first_problem_id; + $first_update_id = $update->id unless $first_update_id; } foreach my $problem (@fixed_problems) { @@ -56,13 +60,9 @@ foreach my $problem (@fixed_problems) { $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'fixed'); } -my $first_problem_id; -my $first_update_id; foreach my $problem (@closed_problems) { $problem->update({ state => 'closed' }); - my ($update) = $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'closed', { confirmed => \'current_timestamp' }); - $first_problem_id = $problem->id unless $first_problem_id; - $first_update_id = $update->id unless $first_update_id; + $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'closed'); } my $categories = scraper { @@ -218,7 +218,7 @@ FixMyStreet::override_config { is $rows[1]->[0], $first_problem_id, 'Correct report ID'; is $rows[1]->[1], $first_update_id, 'Correct update ID'; is $rows[1]->[3], 'confirmed', 'Correct state'; - is $rows[1]->[4], 'closed', 'Correct problem state'; + is $rows[1]->[4], 'action scheduled', 'Correct problem state'; is $rows[1]->[5], 'text', 'Correct text'; is $rows[1]->[6], 'Title', 'Correct name'; }; diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index 3937129d3..480f1ce2d 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -45,7 +45,7 @@ FixMyStreet::override_config { MAPIT_URL => 'http://mapit.uk/', MAP_TYPE => 'Bexley', STAGING_FLAGS => { send_reports => 1, skip_checks => 0 }, - COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com' } } }, + COBRAND_FEATURES => { open311_email => { bexley => { p1 => 'p1@bexley', lighting => 'thirdparty@notbexley.example.com,another@notbexley.example.com' } } }, }, sub { subtest 'cobrand displays council name' => sub { @@ -81,9 +81,9 @@ FixMyStreet::override_config { { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' }, { 'name' => 'reportType', description => 'Type of report', 'value' => 'Vandalism' }, ] }, - { category => 'Lamp post', code => 'LAMP', email => 'thirdparty', + { category => 'Lamp post', code => 'LAMP', email => 'thirdparty.*another', extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'No' } }, - { category => 'Lamp post', code => 'LAMP', email => 'p1.*thirdparty', + { category => 'Lamp post', code => 'LAMP', email => 'thirdparty.*another', extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' } }, ) { ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', { diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index 67088bc54..1eb710e97 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -255,7 +255,7 @@ subtest "fixing passes along the correct message" => sub { like $cgi->param('description'), qr/^FMS-Update:/, 'FMS update prefix included'; unlike $cgi->param('description'), qr/The customer indicated that this issue had been fixed/, 'No fixed message included'; - $c = $mech->create_comment_for_problem($p, $p->user, 'Name', 'Update text', 'f', 'confirmed', 'fixed - user', { confirmed => \'current_timestamp' }); + $c = $mech->create_comment_for_problem($p, $p->user, 'Name', 'Update text', 'f', 'confirmed', 'fixed - user'); $c->discard_changes; # Otherwise cannot set_nanosecond $id = $o->post_service_request_update($c); @@ -367,7 +367,7 @@ my $alert = FixMyStreet::App->model('DB::Alert')->create( { } )->confirm; subtest "sends branded alert emails" => sub { - $mech->create_comment_for_problem($p, $system_user, 'Other User', 'This is some update text', 'f', 'confirmed', undef, { confirmed => DateTime->now->add( minutes => 5 ) }); + $mech->create_comment_for_problem($p, $system_user, 'Other User', 'This is some update text', 'f', 'confirmed', undef); $mech->clear_emails_ok; FixMyStreet::override_config { diff --git a/t/cobrand/westminster.t b/t/cobrand/westminster.t index 303401de6..84def0917 100644 --- a/t/cobrand/westminster.t +++ b/t/cobrand/westminster.t @@ -3,6 +3,10 @@ use Test::MockModule; use FixMyStreet::TestMech; use FixMyStreet::Script::Reports; +# disable info logs for this test run +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Westminster'); diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t index ac6fb870c..adfd4e3c5 100644 --- a/t/open311/post-service-request-updates.t +++ b/t/open311/post-service-request-updates.t @@ -61,7 +61,7 @@ my $other_user = $mech->create_user_ok('test2@example.com', title => 'MRS'); sub c { my ($p, $user) = @_; - my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed', { confirmed => \'current_timestamp' }); + my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed'); $c->discard_changes; return $c; } |