diff options
author | Struan Donald <struan@exo.org.uk> | 2018-03-26 17:09:26 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-04-03 11:08:21 +0100 |
commit | a253bba519da66f2b0d3de09de895b5364de277f (patch) | |
tree | 0338b92787ad50a9d673c70ff2895400d9c37d19 /t | |
parent | 9971657aaf579c37a91f546b01aaee7d96c9db38 (diff) |
limit problem body to single body if required
Add a single_body_only form value to reports that contains the name of
the only body to send the problem to. If the name doesn't match any of
the valid bodies for the report then send to all.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/report_new.t | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index f937acd19..0e7547a85 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -944,9 +944,29 @@ foreach my $test ( # XXX add test for category with multiple bodies foreach my $test ( - { category => 'Street lighting', councils => [ 2226, 2326 ] }, + { + desc => "test report creation for multiple bodies", + category => 'Street lighting', + councils => [ 2226, 2326 ], + extra_fields => {}, + email_count => 2, + }, + { + desc => "test single_body_only means only one report body", + category => 'Street lighting', + councils => [ 2326 ], + extra_fields => { single_body_only => 'Cheltenham Borough Council' }, + email_count => 1, + }, + { + desc => "test invalid single_body_only means multiple report bodies", + category => 'Street lighting', + councils => [ 2226, 2326 ], + extra_fields => { single_body_only => 'Invalid council' }, + email_count => 1, + }, ) { - subtest "test report creation for multiple bodies" => sub { + subtest $test->{desc} => sub { # check that the user does not exist my $test_email = 'test-2@example.com'; @@ -1003,6 +1023,7 @@ foreach my $test ( may_show_name => '1', phone => '07903 123 456', category => $test->{category}, + %{$test->{extra_fields}} } }, "submit good details" |