Skip to content

Commit

Permalink
[CyclingUK] Follow .com questionnaire policy.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 27, 2025
1 parent 3b8f8dd commit ea29456
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions perllib/FixMyStreet/Cobrand/CyclingUK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ sub do_not_reply_email {
return $self->feature('do_not_reply_email') || $self->next::method();
}

=item * Follow .com questionnaire policy
=cut

sub send_questionnaire {
my ($self, $problem) = @_;
my $fms = FixMyStreet::Cobrand::FixMyStreet->new;
my ($send, $body) = $fms->per_body_config('send_questionnaire', $problem);
return $send // 1;

Check warning on line 115 in perllib/FixMyStreet/Cobrand/CyclingUK.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/CyclingUK.pm#L112-L115

Added lines #L112 - L115 were not covered by tests
}

sub admin_allow_user {
my ( $self, $user ) = @_;
Expand Down
12 changes: 12 additions & 0 deletions t/cobrand/cyclinguk.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use Test::MockModule;
use FixMyStreet::TestMech;
use FixMyStreet::Script::Alerts;
use FixMyStreet::Script::Questionnaires;

my $mech = FixMyStreet::TestMech->new;

Expand Down Expand Up @@ -37,6 +38,7 @@ $staff->alerts->create({

my ($problem) = $mech->create_problems_for_body(1, $body->id, 'Title', {
areas => ",2651,", category => 'Potholes', cobrand => 'fixmystreet',
whensent => DateTime->now->subtract( weeks => 5 ),
user => $user,
});

Expand All @@ -46,6 +48,11 @@ FixMyStreet::override_config {
base_url => {
cyclinguk => "http://cyclinguk.fixmystreet.com/",
},
send_questionnaire => {
fixmystreet => {
Bath => 0,
}
},
},
MAPIT_URL => 'http://mapit.uk/',
STAGING_FLAGS => { skip_must_have_2fa => 1 },
Expand Down Expand Up @@ -90,6 +97,11 @@ subtest 'cyclinguk cobrand reports do appear on site' => sub {
$mech->content_contains($problem->title);
$mech->get_ok('/reports/Bath+and+North+East+Somerset');
$mech->content_contains($problem->title);

subtest 'But no questionnaire sent' => sub {
FixMyStreet::Script::Questionnaires::send();
$mech->email_count_is(0);
};
};

$mech->log_in_ok($super->email);
Expand Down

0 comments on commit ea29456

Please sign in to comment.