diff options
| author | Max Wittig <max.wittig@siemens.com> | 2022-08-04 16:36:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-04 16:36:31 +0200 |
| commit | d263f57a34a58d44531e3abbdbfedf354b0c70ca (patch) | |
| tree | 767a6ffd18128fe96108836cc3de714bd672a36d /tests/unit/test_gitlab_http_methods.py | |
| parent | 2ebfc7096ddbf2386029536acef1858985f3f257 (diff) | |
| parent | 1398426cd748fdf492fe6184b03ac2fcb7e4fd6e (diff) | |
| download | gitlab-d263f57a34a58d44531e3abbdbfedf354b0c70ca.tar.gz | |
Merge pull request #2219 from python-gitlab/fix/no-duplicate-params
fix(client): ensure encoded query params are never duplicated
Diffstat (limited to 'tests/unit/test_gitlab_http_methods.py')
| -rw-r--r-- | tests/unit/test_gitlab_http_methods.py | 18 |
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( |
