aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/alert.t22
-rw-r--r--t/app/controller/alert_new.t2
2 files changed, 24 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();
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 7eba90530..d968b56b1 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -523,6 +523,8 @@ subtest "Test alerts are not sent for no-text updates" => sub {
};
$mech->email_count_is(1);
+ $user2->discard_changes;
+ isnt $user2->last_active, undef, 'Last active has been set';
$mech->delete_user($user1);
$mech->delete_user($user2);