Skip to content

Commit 9a92b5d

Browse files
committed
Update query test to check full request url
1 parent b5b74b0 commit 9a92b5d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/test_fga.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,14 +536,20 @@ def test_query(self, mock_query_response, mock_http_client_with_response):
536536
assert response.dict(exclude_none=True) == mock_query_response
537537

538538
def test_query_with_context(
539-
self, mock_query_response, mock_http_client_with_response
539+
self, mock_query_response, capture_and_mock_http_client_request
540540
):
541-
mock_http_client_with_response(self.http_client, mock_query_response, 200)
541+
request_kwargs = capture_and_mock_http_client_request(
542+
self.http_client, mock_query_response, 200
543+
)
542544

543545
response = self.fga.query(
544546
q="select member of type user for permission:view-docs",
545547
order="asc",
546548
warrant_token="warrant_token",
547549
context={"region": "us", "subscription": "pro"},
548550
)
551+
552+
assert request_kwargs["url"] == "https://api.workos.test/fga/v1/query"
553+
expected_full_url = "https://api.workos.test/fga/v1/query?q=select+member+of+type+user+for+permission%3Aview-docs&limit=10&order=asc&context=%7B%22region%22%3A+%22us%22%2C+%22subscription%22%3A+%22pro%22%7D"
554+
assert request_kwargs["full_url"] == expected_full_url
549555
assert response.dict(exclude_none=True) == mock_query_response

0 commit comments

Comments
 (0)