summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-08-04 15:21:39 +0200
committerNejc Habjan <nejc.habjan@siemens.com>2022-08-04 15:21:39 +0200
commit6f71c663a302b20632558b4c94be428ba831ee7f (patch)
treeb6c1ea64339ec9f0d4feffe52a3e0b95108eb721 /tests/unit
parente2ea8b89a7b0aebdb1eb3b99196d7c0034076df8 (diff)
downloadgitlab-6f71c663a302b20632558b4c94be428ba831ee7f.tar.gz
test(unit): reproduce duplicate encoded query params
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_gitlab_http_methods.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/test_gitlab_http_methods.py b/tests/unit/test_gitlab_http_methods.py
index 3d5a3fb..252ecb6 100644
--- a/tests/unit/test_gitlab_http_methods.py
+++ b/tests/unit/test_gitlab_http_methods.py
@@ -37,6 +37,24 @@ def test_http_request(gl):
@responses.activate
+def test_http_request_with_url_encoded_kwargs_does_not_duplicate_params(gl):
+ url = "http://localhost/api/v4/projects?topics%5B%5D=python"
+ responses.add(
+ method=responses.GET,
+ url=url,
+ json=[{"name": "project1"}],
+ status=200,
+ match=[responses.matchers.query_param_matcher({"topics[]": "python"})],
+ )
+
+ kwargs = {"topics[]": "python"}
+ http_r = gl.http_request("get", "/projects?topics%5B%5D=python", **kwargs)
+ http_r.json()
+ assert http_r.status_code == 200
+ assert responses.assert_call_count(url, 1)
+
+
+@responses.activate
def test_http_request_404(gl):
url = "http://localhost/api/v4/not_there"
responses.add(