From bd4a0e010d02c7cf9fad6cfda673d4b1500c6c5a Mon Sep 17 00:00:00 2001 From: tdstein Date: Wed, 20 Mar 2024 12:38:13 -0400 Subject: [PATCH] fix: use query params in count request --- src/posit/connect/users.py | 5 ++++- tests/posit/connect/test_users.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/posit/connect/users.py b/src/posit/connect/users.py index 7d90c04b..3062ced4 100644 --- a/src/posit/connect/users.py +++ b/src/posit/connect/users.py @@ -150,6 +150,9 @@ def delete(self) -> None: raise NotImplementedError() def count(self) -> int: - response: requests.Response = self.session.get(self.url, json={"page_size": 1}) + response: requests.Response = self.session.get( + self.url, params={"page_size": 1} + ) + print(response.json()) result: dict = response.json() return result["total"] diff --git a/tests/posit/connect/test_users.py b/tests/posit/connect/test_users.py index 9a6f3cfd..689a7726 100644 --- a/tests/posit/connect/test_users.py +++ b/tests/posit/connect/test_users.py @@ -274,7 +274,7 @@ def test_count(self): responses.get( "https://connect.example/__api__/v1/users", json=load_mock("v1/users.json"), - match=[responses.matchers.json_params_matcher({"page_size": 1})], + match=[responses.matchers.query_param_matcher({"page_size": 1})], ) con = Client(api_key="12345", url="https://connect.example/") count = con.users.count()