aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/auth.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-11-24 20:31:59 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-11-24 20:31:59 +0000
commitbcfa534f53b759a794bbf6daa736b3ef96d5b698 (patch)
treee66d38712c33c4a062117d36b36ab610ab19614e /t/app/controller/auth.t
parent153e2804eaf462d6a8629aae747ebc722a6f15dc (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/auth.t')
-rw-r--r--t/app/controller/auth.t8
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';