Skip to content

Commit 89e2826

Browse files
committed
fix(client): fix handling of all_secrets for content_scan
1 parent 97e8106 commit 89e2826

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

pygitguardian/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ def content_scan(
389389
endpoint="scan",
390390
data=request_obj,
391391
extra_headers=extra_headers,
392+
params=params,
392393
)
393394

394395
obj: Union[Detail, ScanResult]

tests/test_client.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,34 @@ def test_extra_headers(
574574
assert mock_response.call_count == 1
575575

576576

577+
@responses.activate
578+
@pytest.mark.parametrize("all_secrets", (None, True, False))
579+
def test_scan_parameters(client: GGClient, all_secrets):
580+
"""
581+
GIVEN a ggclient
582+
WHEN calling content_scan with parameters
583+
THEN the parameters are passed in the request
584+
"""
585+
586+
to_match = {}
587+
if all_secrets is not None:
588+
to_match["all_secrets"] = all_secrets
589+
590+
mock_response = responses.post(
591+
url=client._url_from_endpoint("scan", "v1"),
592+
status=200,
593+
match=[matchers.query_param_matcher(to_match)],
594+
)
595+
596+
client.content_scan(
597+
DOCUMENT,
598+
FILENAME,
599+
all_secrets=all_secrets,
600+
)
601+
602+
assert mock_response.call_count == 1
603+
604+
577605
@responses.activate
578606
@pytest.mark.parametrize("ignore_known_secrets", (None, True, False))
579607
@pytest.mark.parametrize("all_secrets", (None, True, False))

0 commit comments

Comments
 (0)