From b7dee1d1a2f34028e4e2935c75b5db31ce52c476 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 Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi --- 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 eacb1381543..6bcc8bd42a4 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; @@ -119,6 +119,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.45.2