Bug 36493: Make cashups test more robust

This patch makes the test independent from existing cash registers in
the system.

To test:
1. Enable UseCashRegisters on a fresh KTD
2. Add a cash register
3. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/cashups.t
=> FAIL: Tests fail!
4. Apply this patch
5. Repeat 3
=> SUCCESS: Tests pass!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4436a7d41a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 19b543a51b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2024-04-02 12:39:02 -03:00 committed by Lucas Gass
parent 8965898873
commit de18918339

View file

@ -63,7 +63,11 @@ subtest 'list() tests' => sub {
## Authorized user tests
# No cash register, so 404 should be returned
$t->get_ok("//$userid:$password@/api/v1/cash_registers/1/cashups")
my $cash_register_to_delete = $builder->build_object( { class => 'Koha::Cash::Registers' } );
my $non_existent_cr_id = $cash_register_to_delete->id;
$cash_register_to_delete->delete;
$t->get_ok("//$userid:$password@/api/v1/cash_registers/$non_existent_cr_id/cashups")
->status_is(404)->json_is( '/error' => 'Register not found' );
my $register = $builder->build_object(