diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-17 15:56:04 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-11-11 10:29:20 +0000 |
commit | d7aca19faade6fb8f4aa47213d0f38b14cb9854a (patch) | |
tree | 41d370d7e69ad994f7f1f6be8d63cf1e692f60df /t | |
parent | e8127dd563cb823a369104e505795e8897d2c1ad (diff) |
[Bromley] Restrict waste lookups per day.
Diffstat (limited to 't')
-rw-r--r-- | t/cobrand/bromley.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index f2b1c7a39..045fdd56d 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -1,8 +1,13 @@ use CGI::Simple; +use Test::MockModule; use FixMyStreet::TestMech; use FixMyStreet::Script::Reports; my $mech = FixMyStreet::TestMech->new; +# Mock fetching bank holidays +my $uk = Test::MockModule->new('FixMyStreet::Cobrand::UK'); +$uk->mock('_fetch_url', sub { '{}' }); + # Create test data my $user = $mech->create_user_ok( 'bromley@example.com', name => 'Bromley' ); my $body = $mech->create_body_ok( 2482, 'Bromley Council'); @@ -247,4 +252,23 @@ subtest 'check heatmap page' => sub { }; }; +subtest 'test waste max-per-day' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'bromley', + COBRAND_FEATURES => { + echo => { bromley => { max_per_day => 1, sample_data => 1 } }, + waste => { bromley => 1 } + }, + }, sub { + SKIP: { + skip( "No memcached", 2 ) unless Memcached::increment('bromley-test'); + Memcached::delete("bromley-test"); + $mech->get_ok('/waste/uprn/12345'); + $mech->get('/waste/uprn/12345'); + is $mech->res->code, 403, 'Now forbidden'; + } + }; + +}; + done_testing(); |