From 395aa2f708a58c9a74db5b1d609fcb591dd4b036 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 5 Jul 2024 12:10:00 +0000 Subject: [PATCH] Bug 37262: Tests for filtering 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 --- t/db_dependent/api/v1/extended_attribute_types.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/extended_attribute_types.t b/t/db_dependent/api/v1/extended_attribute_types.t index 2b1ccf4208..9821ef345b 100755 --- a/t/db_dependent/api/v1/extended_attribute_types.t +++ b/t/db_dependent/api/v1/extended_attribute_types.t @@ -34,7 +34,7 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); subtest 'list() tests' => sub { - plan tests => 20; + plan tests => 23; $schema->storage->txn_begin; @@ -120,6 +120,10 @@ subtest 'list() tests' => sub { $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 ] ); + # Filtering works for unmapped tablename + $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?resource_type=subscription")->status_is(200) + ->json_is( [ $additional_field_yet_another_different_tablename->to_api ] ); + # Warn on unsupported query parameter $t->get_ok("//$userid:$password@/api/v1/extended_attribute_types?blah=blah")->status_is(400) ->json_is( [ { path => '/query/blah', message => 'Malformed query string' } ] ); -- 2.39.2