diff options
author | Struan Donald <struan@exo.org.uk> | 2019-05-13 16:28:03 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2019-05-28 11:34:19 +0100 |
commit | 57c8f272a68fa1fe45a0ff595b71ed7030c0ef0f (patch) | |
tree | 3278429afb5610a19e2ec8573f96f9e1a3ae00c8 | |
parent | 7bb8c6124ee7e2315b934fbe134ff1496964061f (diff) |
[Northamptonshire] cobrand specific tests
-rw-r--r-- | t/Mock/MapIt.pm | 2 | ||||
-rw-r--r-- | t/cobrand/northamptonshire.t | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm index ea1f5b259..cc2a95ef6 100644 --- a/t/Mock/MapIt.pm +++ b/t/Mock/MapIt.pm @@ -37,7 +37,7 @@ my @PLACES = ( [ 'LE15 0GJ', 52.670447, -0.727877, 2600, 'Rutland County Council', 'CTY'], [ 'BR1 3UH', 51.4021, 0.01578, 2482, 'Bromley Council', 'LBO' ], [ 'BR1 3UH', 51.402096, 0.015784, 2482, 'Bromley Council', 'LBO' ], - [ 'NN1 1NS', 52.236251, 0.892052, 2234, 'Northamptonshire County Council', 'CTY' ], + [ 'NN1 1NS', 52.236251, 0.892052, 2234, 'Northamptonshire County Council', 'CTY', 2397, 'Northampton Borough Council', 'DIS' ], [ '?', 50.78301, -0.646929 ], [ 'TA1 1QP', 51.023569, -3.099055, 2239, 'Somerset County Council', 'CTY', 2429, 'Taunton Deane Borough Council', 'DIS' ], [ 'GU51 4AE', 51.279456, -0.846216, 2333, 'Hart District Council', 'DIS', 2227, 'Hampshire County Council', 'CTY' ], diff --git a/t/cobrand/northamptonshire.t b/t/cobrand/northamptonshire.t new file mode 100644 index 000000000..3331f0c99 --- /dev/null +++ b/t/cobrand/northamptonshire.t @@ -0,0 +1,41 @@ +use Test::MockModule; + +use FixMyStreet::TestMech; +my $mech = FixMyStreet::TestMech->new; + +use open ':std', ':encoding(UTF-8)'; + +my $ncc = $mech->create_body_ok(2234, 'Northamptonshire County Council'); +my $nbc = $mech->create_body_ok(2397, 'Northampton Borough Council'); + +my $ncc_contact = $mech->create_contact_ok( + body_id => $ncc->id, + category => 'Trees', + email => 'trees-2234@example.com', +); + +my $nbc_contact = $mech->create_contact_ok( + body_id => $nbc->id, + category => 'Flytipping', + email => 'flytipping-2397@example.com', +); + +subtest 'Check district categories hidden on cobrand' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { northamptonshire => '.' } ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok( '/around' ); + $mech->submit_form_ok( { with_fields => { pc => 'NN1 1NS' } }, + "submit location" ); + is_deeply $mech->page_errors, [], "no errors for pc"; + + $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, + "follow 'skip this step' link" ); + + $mech->content_contains('Trees'); + $mech->content_lacks('Flytipping'); + }; +}; + +done_testing(); |