diff --git a/tests/unit/test_collector.py b/tests/unit/test_collector.py index 5410a4afc03..6aca7bb15f8 100644 --- a/tests/unit/test_collector.py +++ b/tests/unit/test_collector.py @@ -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 @@ def test_fetch_response(self, mock_get_simple_response: mock.Mock) -> None: # _get_simple_response(). mock_get_simple_response.assert_called_once_with( url, + headers=None, session=link_collector.session, )