From 1f544389b39df7e1165826b2e2c0e93a90dfab52 Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Wed, 27 May 2026 12:05:43 -0300 Subject: [PATCH] [ING-30] test: Cover currency filter on lists ## Context The lago-api backend exposes a `currency` query parameter on the subscriptions, wallets, and payment_requests list endpoints (PR #5249). The Python client forwards arbitrary options as query params via find_all, so no source change is needed, but the behavior was untested. ## Description Add a find_all forwarding test for the `currency` option to the subscription, wallet, and payment_request client tests. Each stubs the request with the currency query string, so the test fails if the option is not forwarded. --- tests/test_payment_request_client.py | 14 ++++++++++++++ tests/test_subscription_client.py | 14 ++++++++++++++ tests/test_wallet_client.py | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/tests/test_payment_request_client.py b/tests/test_payment_request_client.py index 5f065dc3..aefcd9b8 100644 --- a/tests/test_payment_request_client.py +++ b/tests/test_payment_request_client.py @@ -91,6 +91,20 @@ def test_valid_find_all_payment_requests_request_with_options(httpx_mock: HTTPXM assert response["meta"]["current_page"] == 1 +def test_valid_find_all_payment_requests_request_with_currency(httpx_mock: HTTPXMock): + client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d") + + httpx_mock.add_response( + method="GET", + url="https://api.getlago.com/api/v1/payment_requests?currency=EUR", + content=mock_collection_response(), + ) + response = client.payment_requests.find_all({"currency": "EUR"}) + + assert response["payment_requests"][0].lago_id == "89b6b61e-4dbc-4307-ac96-4abcfa9e3e2d" + assert response["meta"]["current_page"] == 1 + + def test_invalid_find_all_payment_requests_request(httpx_mock: HTTPXMock): client = Client(api_key="invalid") diff --git a/tests/test_subscription_client.py b/tests/test_subscription_client.py index fbb5d715..3e568d3e 100644 --- a/tests/test_subscription_client.py +++ b/tests/test_subscription_client.py @@ -328,6 +328,20 @@ def test_valid_find_all_subscription_request_with_options(httpx_mock: HTTPXMock) assert response["meta"]["current_page"] == 1 +def test_valid_find_all_subscription_request_with_currency(httpx_mock: HTTPXMock): + client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d") + + httpx_mock.add_response( + method="GET", + url="https://api.getlago.com/api/v1/subscriptions?currency=EUR", + content=mock_collection_response(), + ) + response = client.subscriptions.find_all({"currency": "EUR"}) + + assert response["subscriptions"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b" + assert response["meta"]["current_page"] == 1 + + def test_invalid_find_all_subscription_request(httpx_mock: HTTPXMock): client = Client(api_key="invalid") diff --git a/tests/test_wallet_client.py b/tests/test_wallet_client.py index b3f55b8d..24746e89 100644 --- a/tests/test_wallet_client.py +++ b/tests/test_wallet_client.py @@ -404,6 +404,20 @@ def test_valid_find_all_wallet_request_with_options(httpx_mock: HTTPXMock): assert response["meta"]["current_page"] == 1 +def test_valid_find_all_wallet_request_with_currency(httpx_mock: HTTPXMock): + client = Client(api_key="886fe239-927d-4072-ab72-6dd345e8dd0d") + + httpx_mock.add_response( + method="GET", + url="https://api.getlago.com/api/v1/wallets?currency=EUR", + content=mock_collection_response(), + ) + response = client.wallets.find_all({"currency": "EUR"}) + + assert response["wallets"][0].lago_id == "b7ab2926-1de8-4428-9bcd-779314ac129b" + assert response["meta"]["current_page"] == 1 + + def test_invalid_find_all_wallet_request(httpx_mock: HTTPXMock): client = Client(api_key="invalid")