Skip to content

Commit 799c88f

Browse files
committed
Update some tests to work again
1 parent 9c98346 commit 799c88f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/unit/test_collector.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,17 @@ def test_get_simple_response_dont_log_clear_text_password(
235235
assert resp is not None
236236
mock_raise_for_status.assert_called_once_with(resp)
237237

238-
assert len(caplog.records) == 1
238+
assert len(caplog.records) == 2
239239
record = caplog.records[0]
240240
assert record.levelname == "DEBUG"
241241
assert record.message.splitlines() == [
242242
"Getting page https://user:****@example.com/simple/",
243243
]
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+
]
244249

245250

246251
@pytest.mark.parametrize(
@@ -664,7 +669,8 @@ def test_get_index_content_invalid_content_type(
664669
"pip._internal.index.collector",
665670
logging.WARNING,
666671
"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),
668674
) in caplog.record_tuples
669675

670676

@@ -681,7 +687,7 @@ def make_fake_html_response(url: str) -> mock.Mock:
681687
"""
682688
)
683689
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"})
685691

686692

687693
def test_get_index_content_directory_append_index(tmpdir: Path) -> None:

0 commit comments

Comments
 (0)