diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-29 16:08:54 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-11-11 10:29:19 +0000 |
commit | 613f45c6514ace275b3a49a5d50f7b83ed536b5f (patch) | |
tree | c447d16e87af6d74c078bf04c72aa31c64e7fe4d /t | |
parent | dbde76a5090e772c806bd189426ee078b9b7e4ba (diff) |
[Bromley] Add general enquiries.
This adds general enquiries to the reporting flow.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/waste.t | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/app/controller/waste.t b/t/app/controller/waste.t index 454a593a6..bbd0cd00a 100644 --- a/t/app/controller/waste.t +++ b/t/app/controller/waste.t @@ -29,6 +29,8 @@ create_contact({ category => 'Request new container', email => 'request' }, { code => 'Quantity', required => 1, automated => 'hidden_field' }, { code => 'Container_Type', required => 1, automated => 'hidden_field' }, ); +create_contact({ category => 'General enquiry', email => 'general' }, + { code => 'Notes', description => 'Notes', required => 1, datatype => 'text' }); FixMyStreet::override_config { ALLOWED_COBRANDS => ['bromley', 'fixmystreet'], @@ -106,6 +108,29 @@ FixMyStreet::override_config { is $report->get_extra_field_value('Quantity'), 2; is $report->get_extra_field_value('Container_Type'), 1; }; + subtest 'General enquiry, bad data' => sub { + $mech->get_ok('/waste/uprn/1000000002/enquiry'); + is $mech->uri->path, '/waste/uprn/1000000002'; + $mech->get_ok('/waste/uprn/1000000002/enquiry?category=Bad'); + is $mech->uri->path, '/waste/uprn/1000000002'; + $mech->get_ok('/waste/uprn/1000000002/enquiry?service=1'); + is $mech->uri->path, '/waste/uprn/1000000002'; + }; + subtest 'General enquiry, on behalf of someone else' => sub { + $mech->log_in_ok($staff_user->email); + $mech->get_ok('/waste/uprn/1000000002/enquiry?category=General+enquiry&service_id=537'); + $mech->submit_form_ok({ with_fields => { extra_Notes => 'Some notes' } }); + $mech->submit_form_ok({ with_fields => { name => "Test McTest", email => $user->email } }); + $mech->content_contains('Some notes'); + $mech->content_contains('Test McTest'); + $mech->content_contains($user->email); + $mech->submit_form_ok({ with_fields => { process => 'summary' } }); + $mech->content_contains('Your enquiry has been sent'); + my $report = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; + is $report->get_extra_field_value('Notes'), 'Some notes'; + is $report->user->email, $user->email; + is $report->get_extra_metadata('contributed_by'), $staff_user->id; + }; }; package SOAP::Result; |