diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-09 17:02:12 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-06-09 17:02:12 +0100 |
commit | d363f51268565d955c76a5294b09a7009466e6ae (patch) | |
tree | 6a5249295931a2fc39387d57c13ecdfecc661649 /t/app/controller | |
parent | ef777353e5dda764874b713ff131d36868e94371 (diff) | |
parent | 766f0ed07864ac89a81d9356a8960c3c0744fc99 (diff) |
Merge branch 'recaptcha'
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/alert.t | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index 41aee5bbc..34e68177c 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -1,6 +1,7 @@ use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; +use Test::MockModule; use t::Mock::Nominatim; # check that we can get the page @@ -73,4 +74,25 @@ FixMyStreet::override_config { is $mech->uri->path, '/rss/reports/Cheltenham/Lansdown'; }; +FixMyStreet::override_config { + ALLOWED_COBRANDS => 'fixmystreet', + MAPIT_URL => 'http://mapit.uk/', + GEOCODER => '', + RECAPTCHA => { secret => 'secret', site_key => 'site_key' }, +}, sub { + subtest 'recaptcha' => sub { + $mech->get_ok('/alert/list?pc=EH11BB'); + $mech->content_lacks('g-recaptcha'); # GB is default test country + + my $mod_app = Test::MockModule->new('FixMyStreet::App'); + $mod_app->mock('user_country', sub { 'FR' }); + my $mod_lwp = Test::MockModule->new('LWP::UserAgent'); + $mod_lwp->mock('post', sub { HTTP::Response->new(200, 'OK', [], '{ "success": true }') }); + + $mech->get_ok('/alert/list?pc=EH11BB'); + $mech->content_contains('g-recaptcha'); + $mech->submit_form_ok({ with_fields => { rznvy => 'someone@example.org' } }); + }; +}; + done_testing(); |