fix test failures

This commit is contained in:
Danny McClanahan 2023-09-03 07:15:34 -04:00
parent c396596b7b
commit 5cc8a36edd
No known key found for this signature in database
GPG Key ID: CE8D0DA71DEFC1DF
2 changed files with 13 additions and 4 deletions

View File

@ -903,6 +903,11 @@ class PackageFinder:
def _process_project_url_uncached(
self, project_url: Link, link_evaluator: LinkEvaluator
) -> List[InstallationCandidate]:
logger.debug(
"Fetching project page and analyzing links: %s",
project_url,
)
index_response = self._link_collector.fetch_response(project_url)
if index_response is None:
return []

View File

@ -90,7 +90,7 @@ def test_get_simple_response_archive_to_http_scheme(
session.assert_has_calls(
[
mock.call.head(url, allow_redirects=True),
mock.call.head(url, allow_redirects=True, headers=None),
]
)
mock_raise_for_status.assert_called_once_with(session.head.return_value)
@ -152,7 +152,7 @@ def test_get_simple_response_archive_to_http_scheme_is_html(
assert resp is not None
assert session.mock_calls == [
mock.call.head(url, allow_redirects=True),
mock.call.head(url, allow_redirects=True, headers=None),
mock.call.get(
url,
headers={
@ -240,7 +240,7 @@ def test_get_simple_response_dont_log_clear_text_password(
assert resp is not None
mock_raise_for_status.assert_called_once_with(resp)
assert len(caplog.records) == 2
assert len(caplog.records) == 3
record = caplog.records[0]
assert record.levelname == "DEBUG"
assert record.message.splitlines() == [
@ -248,6 +248,9 @@ def test_get_simple_response_dont_log_clear_text_password(
]
record = caplog.records[1]
assert record.levelname == "DEBUG"
assert record.message.splitlines() == ["headers: None"]
record = caplog.records[2]
assert record.levelname == "DEBUG"
assert record.message.splitlines() == [
"Fetched page https://user:****@example.com/simple/ as text/html",
]
@ -838,7 +841,7 @@ def test_get_index_content_directory_append_index(tmpdir: Path) -> None:
mock_func.return_value = fake_response
actual = _get_index_content(Link(dir_url), session=session)
assert mock_func.mock_calls == [
mock.call(expected_url, session=session),
mock.call(expected_url, headers=None, session=session),
], f"actual calls: {mock_func.mock_calls}"
assert actual is not None
@ -957,6 +960,7 @@ class TestLinkCollector:
# _get_simple_response().
mock_get_simple_response.assert_called_once_with(
url,
headers=None,
session=link_collector.session,
)