Lines 224-232
subtest 'update() tests' => sub {
Link Here
|
224 |
|
224 |
|
225 |
my $city_id = $builder->build( { source => 'City' } )->{cityid}; |
225 |
my $city_id = $builder->build( { source => 'City' } )->{cityid}; |
226 |
|
226 |
|
|
|
227 |
# Full object update on PUT |
228 |
my $city_with_updated_field = { |
229 |
city_name => "London", |
230 |
city_state => "City State", |
231 |
city_zipcode => "City Zipcode", |
232 |
city_country => "City Country" |
233 |
}; |
234 |
|
227 |
# Unauthorized attempt to update |
235 |
# Unauthorized attempt to update |
228 |
my $tx = $t->ua->build_tx( PUT => "/api/v1/cities/$city_id" => json => |
236 |
my $tx = $t->ua->build_tx( PUT => "/api/v1/cities/$city_id" => json => |
229 |
{ city_name => 'New unauthorized name change' } ); |
237 |
$city_with_updated_field ); |
230 |
$tx->req->cookies( |
238 |
$tx->req->cookies( |
231 |
{ name => 'CGISESSID', value => $unauthorized_session_id } ); |
239 |
{ name => 'CGISESSID', value => $unauthorized_session_id } ); |
232 |
$tx->req->env( { REMOTE_ADDR => $remote_address } ); |
240 |
$tx->req->env( { REMOTE_ADDR => $remote_address } ); |
Lines 249-262
subtest 'update() tests' => sub {
Link Here
|
249 |
[ { message => "Missing property.", path => "/body/city_zipcode" } ] |
257 |
[ { message => "Missing property.", path => "/body/city_zipcode" } ] |
250 |
); |
258 |
); |
251 |
|
259 |
|
252 |
# Full object update on PUT |
|
|
253 |
my $city_with_updated_field = { |
254 |
city_name => "London", |
255 |
city_state => "City State", |
256 |
city_zipcode => "City Zipcode", |
257 |
city_country => "City Country" |
258 |
}; |
259 |
|
260 |
$tx = $t->ua->build_tx( |
260 |
$tx = $t->ua->build_tx( |
261 |
PUT => "/api/v1/cities/$city_id" => json => $city_with_updated_field ); |
261 |
PUT => "/api/v1/cities/$city_id" => json => $city_with_updated_field ); |
262 |
$tx->req->cookies( |
262 |
$tx->req->cookies( |
263 |
- |
|
|