Skip to content

Commit 6f71c66

Browse files
committed
test(unit): reproduce duplicate encoded query params
1 parent e2ea8b8 commit 6f71c66

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/unit/test_gitlab_http_methods.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ def test_http_request(gl):
3636
assert responses.assert_call_count(url, 1) is True
3737

3838

39+
@responses.activate
40+
def test_http_request_with_url_encoded_kwargs_does_not_duplicate_params(gl):
41+
url = "http://localhost/api/v4/projects?topics%5B%5D=python"
42+
responses.add(
43+
method=responses.GET,
44+
url=url,
45+
json=[{"name": "project1"}],
46+
status=200,
47+
match=[responses.matchers.query_param_matcher({"topics[]": "python"})],
48+
)
49+
50+
kwargs = {"topics[]": "python"}
51+
http_r = gl.http_request("get", "/projects?topics%5B%5D=python", **kwargs)
52+
http_r.json()
53+
assert http_r.status_code == 200
54+
assert responses.assert_call_count(url, 1)
55+
56+
3957
@responses.activate
4058
def test_http_request_404(gl):
4159
url = "http://localhost/api/v4/not_there"

0 commit comments

Comments
 (0)