From bcfa534f53b759a794bbf6daa736b3ef96d5b698 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 24 Nov 2016 20:31:59 +0000 Subject: Pass test if NXDOMAINs are intercepted. Mock out the DNS lookup to fail, in case the test is being run somewhere where the ISP hijacks NXDOMAIN results and redirects them elsewhere. --- t/app/controller/auth.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/app/controller/auth.t') diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t index 251aa2977..22ade6f4b 100644 --- a/t/app/controller/auth.t +++ b/t/app/controller/auth.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::MockModule; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -33,6 +34,13 @@ for my $test ( ) { my ( $email, $error_message ) = @$test; + + my $resolver = Test::MockModule->new('Net::DNS::Resolver'); + $resolver->mock('send', sub { + my ($self, $domain, $type) = @_; + return Net::DNS::Packet->new; + }); + pass "--- testing bad email '$email' gives error '$error_message'"; $mech->get_ok('/auth'); is_deeply $mech->page_errors, [], 'no errors initially'; -- cgit v1.2.3