diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/auth_profile.t | 4 | ||||
-rw-r--r-- | t/cobrand/fixmystreet.t | 4 | ||||
-rw-r--r-- | t/cobrand/isleofwight.t | 12 | ||||
-rw-r--r-- | t/cobrand/westminster.t | 2 |
4 files changed, 21 insertions, 1 deletions
diff --git a/t/app/controller/auth_profile.t b/t/app/controller/auth_profile.t index f68b64835..4b7db19b5 100644 --- a/t/app/controller/auth_profile.t +++ b/t/app/controller/auth_profile.t @@ -5,9 +5,13 @@ sub must_have_2fa { 1 } package main; +use Test::MockModule; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; +my $resolver = Test::MockModule->new('Email::Valid'); +$resolver->mock('address', sub { $_[1] }); + use t::Mock::Twilio; my $twilio = t::Mock::Twilio->new; diff --git a/t/cobrand/fixmystreet.t b/t/cobrand/fixmystreet.t index fedb06f40..a54e782f2 100644 --- a/t/cobrand/fixmystreet.t +++ b/t/cobrand/fixmystreet.t @@ -1,9 +1,13 @@ use utf8; use FixMyStreet::Script::UpdateAllReports; +use Test::MockModule; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; +my $resolver = Test::MockModule->new('Email::Valid'); +$resolver->mock('address', sub { $_[1] }); + my $body = $mech->create_body_ok( 2514, 'Birmingham' ); my $contact = $mech->create_contact_ok( diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index fd08ce455..f945dc924 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -1,5 +1,6 @@ use CGI::Simple; use DateTime; +use Test::MockModule; use FixMyStreet::TestMech; use Open311; use Open311::GetServiceRequests; @@ -8,6 +9,16 @@ use Open311::PostServiceRequestUpdates; use FixMyStreet::Script::Alerts; use FixMyStreet::Script::Reports; +# disable info logs for this test run +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + +my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::IsleOfWight'); +$cobrand->mock('lookup_site_code', sub { + my ($self, $row) = @_; + return "Road ID" if $row->latitude == 50.7108; +}); + ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); my $params = { @@ -290,6 +301,7 @@ subtest 'Check special Open311 request handling', sub { my $req = $test_data->{test_req_used}; my $c = CGI::Simple->new($req->content); is $c->param('attribute[urgent]'), undef, 'no urgent param sent'; + is $c->param('attribute[site_code]'), 'Road ID', 'road ID set'; $mech->email_count_is(1); my $email = $mech->get_email; diff --git a/t/cobrand/westminster.t b/t/cobrand/westminster.t index 84def0917..54de5a160 100644 --- a/t/cobrand/westminster.t +++ b/t/cobrand/westminster.t @@ -79,7 +79,7 @@ FixMyStreet::override_config { $mech->content_contains($comment3->text); }; - subtest 'Reports don’t show updates from fixmystreet.com cobrand' => sub { + subtest "Reports don't show updates from fixmystreet.com cobrand" => sub { $mech->get_ok('/report/' . $report->id); $mech->content_lacks($comment2->text); }; |