Bug 40517: (QA follow-up): Fix tests
Enforce no hold group when creating hold object When a hold is created by build_object, it's auto-assigned a hold_group_id (as expected). When a hold is ->fill, it's hold_group_id is cleared by cleanup_hold_group (as expected). The problem is then this causes the object before ->fill to be out of sync with the up to date object returned by the API (i.e. the latter has an empty hold_group_id, as expected, but the former has the auto-assigned hold_group_id). Using ->discard_changes or ->get_from_storage doesnt work because the became a after ->fill. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
d77c826c8c
commit
11ea8d533d
|
|
@ -53,9 +53,12 @@ subtest 'list() tests' => sub {
|
|||
$t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds' )->status_is( 200, 'REST3.2.2' )
|
||||
->json_is( [] );
|
||||
|
||||
my $hold_1 = $builder->build_object( { class => 'Koha::Holds', value => { borrowernumber => $patron->id } } );
|
||||
my $hold_2 = $builder->build_object( { class => 'Koha::Holds', value => { borrowernumber => $patron->id } } );
|
||||
my $hold_3 = $builder->build_object( { class => 'Koha::Holds', value => { borrowernumber => $patron->id } } );
|
||||
my $hold_1 = $builder->build_object(
|
||||
{ class => 'Koha::Holds', value => { hold_group_id => undef, borrowernumber => $patron->id } } );
|
||||
my $hold_2 = $builder->build_object(
|
||||
{ class => 'Koha::Holds', value => { hold_group_id => undef, borrowernumber => $patron->id } } );
|
||||
my $hold_3 = $builder->build_object(
|
||||
{ class => 'Koha::Holds', value => { hold_group_id => undef, borrowernumber => $patron->id } } );
|
||||
|
||||
$t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?_order_by=+me.hold_id' )
|
||||
->status_is( 200, 'REST3.2.2' )
|
||||
|
|
|
|||
Loading…
Reference in New Issue