diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-11-24 20:31:59 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-11-24 20:31:59 +0000 |
commit | bcfa534f53b759a794bbf6daa736b3ef96d5b698 (patch) | |
tree | e66d38712c33c4a062117d36b36ab610ab19614e /t/app/controller | |
parent | 153e2804eaf462d6a8629aae747ebc722a6f15dc (diff) |
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.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/auth.t | 8 |
1 files changed, 8 insertions, 0 deletions
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'; |