@@ -235,12 +235,17 @@ def test_get_simple_response_dont_log_clear_text_password(
235
235
assert resp is not None
236
236
mock_raise_for_status .assert_called_once_with (resp )
237
237
238
- assert len (caplog .records ) == 1
238
+ assert len (caplog .records ) == 2
239
239
record = caplog .records [0 ]
240
240
assert record .levelname == "DEBUG"
241
241
assert record .message .splitlines () == [
242
242
"Getting page https://user:****@example.com/simple/" ,
243
243
]
244
+ record = caplog .records [1 ]
245
+ assert record .levelname == "DEBUG"
246
+ assert record .message .splitlines () == [
247
+ "Fetched page https://user:****@example.com/simple/ as text/html" ,
248
+ ]
244
249
245
250
246
251
@pytest .mark .parametrize (
@@ -664,7 +669,8 @@ def test_get_index_content_invalid_content_type(
664
669
"pip._internal.index.collector" ,
665
670
logging .WARNING ,
666
671
"Skipping page {} because the GET request got Content-Type: {}."
667
- "The only supported Content-Type is text/html" .format (url , content_type ),
672
+ "The only supported Content-Types are application/vnd.pypi.simple.v1+json, "
673
+ "application/vnd.pypi.simple.v1+html, and text/html'" .format (url , content_type ),
668
674
) in caplog .record_tuples
669
675
670
676
@@ -681,7 +687,7 @@ def make_fake_html_response(url: str) -> mock.Mock:
681
687
"""
682
688
)
683
689
content = html .encode ("utf-8" )
684
- return mock .Mock (content = content , url = url , headers = {})
690
+ return mock .Mock (content = content , url = url , headers = {"Content-Type" : "text/html" })
685
691
686
692
687
693
def test_get_index_content_directory_append_index (tmpdir : Path ) -> None :
0 commit comments