From d498bda1a68f0612b33eb83ec5d8c1a8a70fe1e0 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, refresh the API bundle, run: yarn api:bundle 4) Run tests again, notice they pass --- 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