Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3cd928c

Browse files
test: fix failing tests that use 204 (No Content) plus content
urllib3>=2 now checks for expected content length. Also codes 204 and304 are set to expect a content length of 0 [1]So in the unit tests stop setting content to return in thesesituations.[1]https://github.com/urllib3/urllib3/blob/88a707290b655394aade060a8b7eaee83152dc8b/src/urllib3/response.py#L691-L693
1 parent8d2d297 commit3cd928c

18 files changed

+21
-70
lines changed

‎tests/unit/objects/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ def created_content():
2121
return {"message":"201 Created"}
2222

2323

24-
@pytest.fixture
25-
defno_content():
26-
return {"message":"204 No Content"}
27-
28-
2924
@pytest.fixture
3025
defresp_export(accepted_content,binary_content):
3126
"""Common fixture for group and project exports."""

‎tests/unit/objects/test_badges.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ def resp_update_badge():
9797

9898

9999
@pytest.fixture()
100-
defresp_delete_badge(no_content):
100+
defresp_delete_badge():
101101
withresponses.RequestsMock()asrsps:
102102
rsps.add(
103103
method=responses.DELETE,
104104
url=re.compile(r"http://localhost/api/v4/(projects|groups)/1/badges/1"),
105-
json=no_content,
106-
content_type="application/json",
107105
status=204,
108106
)
109107
yieldrsps

‎tests/unit/objects/test_group_access_tokens.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ def resp_revoke_group_access_token():
7575
rsps.add(
7676
method=responses.DELETE,
7777
url="http://localhost/api/v4/groups/1/access_tokens/42",
78-
json=content,
79-
content_type="application/json",
8078
status=204,
8179
)
8280
rsps.add(

‎tests/unit/objects/test_groups.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def resp_update_push_rules_group():
215215

216216

217217
@pytest.fixture
218-
defresp_delete_push_rules_group(no_content):
218+
defresp_delete_push_rules_group():
219219
withresponses.RequestsMock()asrsps:
220220
rsps.add(
221221
method=responses.GET,
@@ -227,15 +227,13 @@ def resp_delete_push_rules_group(no_content):
227227
rsps.add(
228228
method=responses.DELETE,
229229
url="http://localhost/api/v4/groups/1/push_rule",
230-
json=no_content,
231-
content_type="application/json",
232230
status=204,
233231
)
234232
yieldrsps
235233

236234

237235
@pytest.fixture
238-
defresp_list_ldap_group_links(no_content):
236+
defresp_list_ldap_group_links():
239237
withresponses.RequestsMock()asrsps:
240238
rsps.add(
241239
method=responses.GET,
@@ -292,7 +290,7 @@ def resp_create_saml_group_link():
292290

293291

294292
@pytest.fixture
295-
defresp_delete_saml_group_link(no_content):
293+
defresp_delete_saml_group_link():
296294
withresponses.RequestsMock()asrsps:
297295
rsps.add(
298296
method=responses.POST,
@@ -309,8 +307,6 @@ def resp_delete_saml_group_link(no_content):
309307
rsps.add(
310308
method=responses.DELETE,
311309
url="http://localhost/api/v4/groups/1/saml_group_links/saml-group-1",
312-
json=no_content,
313-
content_type="application/json",
314310
status=204,
315311
)
316312
yieldrsps

‎tests/unit/objects/test_job_artifacts.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ def resp_artifacts_by_ref_name(binary_content):
2525

2626

2727
@pytest.fixture
28-
defresp_project_artifacts_delete(no_content):
28+
defresp_project_artifacts_delete():
2929
withresponses.RequestsMock()asrsps:
3030
rsps.add(
3131
method=responses.DELETE,
3232
url="http://localhost/api/v4/projects/1/artifacts",
33-
json=no_content,
34-
content_type="application/json",
3533
status=204,
3634
)
3735
yieldrsps

‎tests/unit/objects/test_members.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
@pytest.fixture
26-
defresp_create_group_member(no_content):
26+
defresp_create_group_member():
2727
withresponses.RequestsMock()asrsps:
2828
rsps.add(
2929
method=responses.POST,
@@ -49,13 +49,11 @@ def resp_list_billable_group_members():
4949

5050

5151
@pytest.fixture
52-
defresp_delete_billable_group_member(no_content):
52+
defresp_delete_billable_group_member():
5353
withresponses.RequestsMock()asrsps:
5454
rsps.add(
5555
method=responses.DELETE,
5656
url="http://localhost/api/v4/groups/1/billable_members/1",
57-
json=no_content,
58-
content_type="application/json",
5957
status=204,
6058
)
6159
yieldrsps

‎tests/unit/objects/test_packages.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,33 +137,29 @@ def resp_get_package():
137137

138138

139139
@pytest.fixture
140-
defresp_delete_package(no_content):
140+
defresp_delete_package():
141141
withresponses.RequestsMock()asrsps:
142142
rsps.add(
143143
method=responses.DELETE,
144144
url="http://localhost/api/v4/projects/1/packages/1",
145-
json=no_content,
146-
content_type="application/json",
147145
status=204,
148146
)
149147
yieldrsps
150148

151149

152150
@pytest.fixture
153-
defresp_delete_package_file(no_content):
151+
defresp_delete_package_file():
154152
withresponses.RequestsMock()asrsps:
155153
rsps.add(
156154
method=responses.DELETE,
157155
url="http://localhost/api/v4/projects/1/packages/1/package_files/1",
158-
json=no_content,
159-
content_type="application/json",
160156
status=204,
161157
)
162158
yieldrsps
163159

164160

165161
@pytest.fixture
166-
defresp_delete_package_file_list(no_content):
162+
defresp_delete_package_file_list():
167163
withresponses.RequestsMock()asrsps:
168164
rsps.add(
169165
method=responses.GET,
@@ -178,8 +174,6 @@ def resp_delete_package_file_list(no_content):
178174
rsps.add(
179175
method=responses.DELETE,
180176
url=f"http://localhost/api/v4/projects/1/packages/1/package_files/{pkg_file_id}",
181-
json=no_content,
182-
content_type="application/json",
183177
status=204,
184178
)
185179
yieldrsps

‎tests/unit/objects/test_personal_access_tokens.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ def resp_get_personal_access_token_self():
8181

8282

8383
@pytest.fixture
84-
defresp_delete_personal_access_token(no_content):
84+
defresp_delete_personal_access_token():
8585
withresponses.RequestsMock()asrsps:
8686
rsps.add(
8787
method=responses.DELETE,
8888
url=single_token_url,
89-
json=no_content,
90-
content_type="application/json",
9189
status=204,
9290
)
9391
yieldrsps

‎tests/unit/objects/test_project_access_tokens.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ def resp_revoke_project_access_token():
7575
rsps.add(
7676
method=responses.DELETE,
7777
url="http://localhost/api/v4/projects/1/access_tokens/42",
78-
json=content,
79-
content_type="application/json",
8078
status=204,
8179
)
8280
rsps.add(

‎tests/unit/objects/test_project_merge_request_approvals.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,11 @@ def resp_mr_approval_rules():
147147

148148

149149
@pytest.fixture
150-
defresp_delete_mr_approval_rule(no_content):
150+
defresp_delete_mr_approval_rule():
151151
withresponses.RequestsMock()asrsps:
152152
rsps.add(
153153
method=responses.DELETE,
154154
url="http://localhost/api/v4/projects/1/merge_requests/1/approval_rules/1",
155-
json=no_content,
156-
content_type="application/json",
157155
status=204,
158156
)
159157
yieldrsps

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp