From 94e2fa2e9ee0faf429b4c1402b43283ef53292d7 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 21 May 2025 16:41:45 +0100 Subject: [PATCH] test: add rpc get, head and count tests --- ...test_filter_request_builder_integration.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/_async/test_filter_request_builder_integration.py b/tests/_async/test_filter_request_builder_integration.py index 11e8ae1..26d5260 100644 --- a/tests/_async/test_filter_request_builder_integration.py +++ b/tests/_async/test_filter_request_builder_integration.py @@ -483,6 +483,48 @@ async def test_rpc_with_range(): ] +async def test_rpc_post_with_args(): + res = ( + await rest_client() + .rpc("search_countries_by_name", {"search_name": "Alban"}) + .select("nicename, iso") + .execute() + ) + assert res.data == [{"nicename": "Albania", "iso": "AL"}] + + +async def test_rpc_get_with_args(): + res = ( + await rest_client() + .rpc("search_countries_by_name", {"search_name": "Alger"}, get=True) + .select("nicename, iso") + .execute() + ) + assert res.data == [{"nicename": "Algeria", "iso": "DZ"}] + + +async def test_rpc_get_with_count(): + res = ( + await rest_client() + .rpc("search_countries_by_name", {"search_name": "Al"}, get=True, count="exact") + .select("nicename") + .execute() + ) + assert res.count == 2 + assert res.data == [{"nicename": "Albania"}, {"nicename": "Algeria"}] + + +async def test_rpc_head_count(): + res = ( + await rest_client() + .rpc("search_countries_by_name", {"search_name": "Al"}, head=True, count="exact") + .execute() + ) + + assert res.count == 2 + assert res.data == [] + + async def test_order(): res = ( await rest_client()