Open jbsilva opened 2 days ago
As stated in the get_api_keys documentation, the parameter nameQuery is used to filter API Keys by name.
get_api_keys
nameQuery
Moto is completely ignoring the query and returning all the keys independently of value passed.
In the following example, the second assert fails because all keys are returned when only the second should match the nameQuery.
Even if nameQuery does not guarantee an exact match, Moto should have a similar behavior to AWS.
import boto3 import pytest from moto import mock_aws @pytest.fixture() def api_gateway_mock(): with mock_aws(): ag_client = boto3.client("apigateway") ag_client.create_api_key( name="123-456", description="Mock API key 123-456", enabled=True, tags={"user": "123"}, ) ag_client.create_api_key( name="654-321", description="Mock API key 654-321", enabled=True, tags={"user": "654"}, ) yield ag_client def test_get_api_keys(api_gateway_mock): all_keys = api_gateway_mock.get_api_keys(limit=10).get("items", []) assert len(all_keys) == 2 key_123 = api_gateway_mock.get_api_keys(nameQuery="123-456", limit=10).get("items", []) assert len(key_123) == 1
Moto version: 5.0.15
get_api_keys is marked as implemented in https://docs.getmoto.org/en/latest/docs/services/apigateway.html
same for get_usage_plans for me
get_usage_plans
As stated in the
get_api_keys
documentation, the parameternameQuery
is used to filter API Keys by name.Moto is completely ignoring the query and returning all the keys independently of value passed.
In the following example, the second assert fails because all keys are returned when only the second should match the nameQuery.
Even if
nameQuery
does not guarantee an exact match, Moto should have a similar behavior to AWS.Moto version: 5.0.15
get_api_keys
is marked as implemented in https://docs.getmoto.org/en/latest/docs/services/apigateway.html