aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-04-09 13:48:48 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-04-15 07:47:12 +0100
commitddfbb2a529ec5f5977a6f4d65aa52648cf2a707e (patch)
treefd2d1e9b5007f0b42523304f365e3b15fd3e801b /t
parent51cf9b915f2273c787f0a64658b56de941ae1c3a (diff)
[Peterborough] Improve extra question handling.
Ignore (for Open311-sending purposes) any questions whose code starts "PCC-", so that it is easier to use the admin to add extra questions, and move the removal of the extra questions to a more normal location so answers are not lost when extra fields is reset post-send.
Diffstat (limited to 't')
-rw-r--r--t/cobrand/peterborough.t9
1 files changed, 6 insertions, 3 deletions
diff --git a/t/cobrand/peterborough.t b/t/cobrand/peterborough.t
index 6a442a7c6..d61b3de75 100644
--- a/t/cobrand/peterborough.t
+++ b/t/cobrand/peterborough.t
@@ -22,9 +22,10 @@ subtest 'open311 request handling', sub {
}, sub {
my $contact = $mech->create_contact_ok(body_id => $peterborough->id, category => 'Trees', email => 'TREES');
my ($p) = $mech->create_problems_for_body(1, $peterborough->id, 'Title', { category => 'Trees', latitude => 52.5608, longitude => 0.2405, cobrand => 'peterborough' });
- $p->set_extra_fields({ name => 'emergency', value => 'no'});
- $p->set_extra_fields({ name => 'private_land', value => 'no'});
- $p->set_extra_fields({ name => 'tree_code', value => 'tree-42'});
+ $p->push_extra_fields({ name => 'emergency', value => 'no'});
+ $p->push_extra_fields({ name => 'private_land', value => 'no'});
+ $p->push_extra_fields({ name => 'PCC-light', value => 'whatever'});
+ $p->push_extra_fields({ name => 'tree_code', value => 'tree-42'});
$p->update;
my $test_data = FixMyStreet::Script::Reports::send();
@@ -33,11 +34,13 @@ subtest 'open311 request handling', sub {
ok $p->whensent, 'Report marked as sent';
is $p->send_method_used, 'Open311', 'Report sent via Open311';
is $p->external_id, 248, 'Report has correct external ID';
+ is $p->get_extra_field_value('emergency'), 'no';
my $req = $test_data->{test_req_used};
my $c = CGI::Simple->new($req->content);
is $c->param('attribute[emergency]'), undef, 'no emergency param sent';
is $c->param('attribute[private_land]'), undef, 'no private_land param sent';
+ is $c->param('attribute[PCC-light]'), undef, 'no pcc- param sent';
is $c->param('attribute[tree_code]'), 'tree-42', 'tree_code param sent';
};
};