Bug 37261: Add tests for returning unmapped tablename
Test plan: 1) Apply this patch only, run tests: prove t/db_dependent/api/v1/extended_attribute_types.t 2) Notice they fail 3) Apply the fix patch, run tests again Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Edit: amended to get rid of tidy errors Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
f02d90938d
commit
f23f731de2
1 changed files with 18 additions and 1 deletions
|
@ -34,7 +34,7 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
|
|||
|
||||
subtest 'list() tests' => sub {
|
||||
|
||||
plan tests => 17;
|
||||
plan tests => 20;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
@ -98,6 +98,23 @@ subtest 'list() tests' => sub {
|
|||
]
|
||||
);
|
||||
|
||||
my $additional_field_yet_another_different_tablename = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::AdditionalFields',
|
||||
value => { tablename => 'subscription', name => 'fourth_af_name' },
|
||||
}
|
||||
);
|
||||
|
||||
# Four additional fields created, they should both be returned
|
||||
$t->get_ok("//$userid:$password@/api/v1/extended_attribute_types")->status_is(200)->json_is(
|
||||
[
|
||||
$additional_field->to_api,
|
||||
$another_additional_field->to_api,
|
||||
$additional_field_different_tablename->to_api,
|
||||
$additional_field_yet_another_different_tablename->to_api,
|
||||
]
|
||||
);
|
||||
|
||||
# Filtering works, two existing additional fields returned for the queried table name
|
||||
$t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=invoice")->status_is(200)
|
||||
->json_is( [ $additional_field->to_api, $another_additional_field->to_api ] );
|
||||
|
|
Loading…
Reference in a new issue