Skip to content

Commit e792d8a

Browse files
authored
test: add rpc get, head and count tests (#598)
1 parent 3c8bdae commit e792d8a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/_async/test_filter_request_builder_integration.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,48 @@ async def test_rpc_with_range():
483483
]
484484

485485

486+
async def test_rpc_post_with_args():
487+
res = (
488+
await rest_client()
489+
.rpc("search_countries_by_name", {"search_name": "Alban"})
490+
.select("nicename, iso")
491+
.execute()
492+
)
493+
assert res.data == [{"nicename": "Albania", "iso": "AL"}]
494+
495+
496+
async def test_rpc_get_with_args():
497+
res = (
498+
await rest_client()
499+
.rpc("search_countries_by_name", {"search_name": "Alger"}, get=True)
500+
.select("nicename, iso")
501+
.execute()
502+
)
503+
assert res.data == [{"nicename": "Algeria", "iso": "DZ"}]
504+
505+
506+
async def test_rpc_get_with_count():
507+
res = (
508+
await rest_client()
509+
.rpc("search_countries_by_name", {"search_name": "Al"}, get=True, count="exact")
510+
.select("nicename")
511+
.execute()
512+
)
513+
assert res.count == 2
514+
assert res.data == [{"nicename": "Albania"}, {"nicename": "Algeria"}]
515+
516+
517+
async def test_rpc_head_count():
518+
res = (
519+
await rest_client()
520+
.rpc("search_countries_by_name", {"search_name": "Al"}, head=True, count="exact")
521+
.execute()
522+
)
523+
524+
assert res.count == 2
525+
assert res.data == []
526+
527+
486528
async def test_order():
487529
res = (
488530
await rest_client()

0 commit comments

Comments
 (0)