-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bromley][WW] Truncate text to maximum field length
Notes text should not exceed maximum length for notes field. mysociety/societyworks#4232
- Loading branch information
1 parent
e1502a0
commit 06f689d
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,11 @@ $soap_lite->mock(call => sub { | |
is $loc[1]->value, 'Behind the wall'; | ||
my @notes = ${$data[5]->value}->value; | ||
is $notes[0]->value, 1006; | ||
is $notes[1]->value, 'This is the details'; | ||
if ($notes[1]->value =~ /^Closed report has a/) { | ||
is $notes[1]->value, 'Closed report has a new comment: comment that was left | Jay User [email protected] | This was the text!' . 'a' x 1897 . '...', | ||
} else { | ||
is $notes[1]->value, 'This is the details'; | ||
} | ||
my @type = ${$data[6]->value}->value; | ||
is $type[0]->value, 1007; | ||
is $type[1]->value, 3; | ||
|
@@ -163,6 +167,32 @@ subtest "POST add assisted collection OK" => sub { | |
} ], 'correct json returned'; | ||
}; | ||
|
||
subtest "POST add assisted collection OK" => sub { | ||
my $res = $endpoint->run_test_request( | ||
POST => '/requests.json', | ||
api_key => 'test', | ||
service_code => EVENT_TYPE_ASSISTED . "-add", | ||
first_name => 'Bob', | ||
last_name => 'Mould', | ||
description => "Closed report has a new comment: comment that was left\r\nJay User user\@user.com\r\nThis was the text!" . 'a' x 2000, | ||
lat => 51, | ||
long => -1, | ||
'attribute[service_id]' => 531, # Domestic refuse | ||
'attribute[uprn]' => 1000001, | ||
'attribute[fixmystreet_id]' => 2000123, | ||
'attribute[Exact_Location]' => 'Behind the wall', | ||
'attribute[Container_Type]' => 3, | ||
'attribute[title]' => 'MRS', | ||
); | ||
ok $res->is_success, 'valid request' | ||
or diag $res->content; | ||
|
||
is_deeply decode_json($res->content), | ||
[ { | ||
"service_request_id" => '1234', | ||
} ], 'correct json returned'; | ||
}; | ||
|
||
subtest "POST remove assisted collection OK" => sub { | ||
my $res = $endpoint->run_test_request( | ||
POST => '/requests.json', | ||
|