Skip to content

Commit 2ecc6c4

Browse files
fix test failures
1 parent b69c817 commit 2ecc6c4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/unit/test_collector.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_get_simple_response_archive_to_http_scheme(
9090

9191
session.assert_has_calls(
9292
[
93-
mock.call.head(url, allow_redirects=True),
93+
mock.call.head(url, allow_redirects=True, headers=None),
9494
]
9595
)
9696
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(
152152

153153
assert resp is not None
154154
assert session.mock_calls == [
155-
mock.call.head(url, allow_redirects=True),
155+
mock.call.head(url, allow_redirects=True, headers=None),
156156
mock.call.get(
157157
url,
158158
headers={
@@ -240,14 +240,17 @@ def test_get_simple_response_dont_log_clear_text_password(
240240
assert resp is not None
241241
mock_raise_for_status.assert_called_once_with(resp)
242242

243-
assert len(caplog.records) == 2
243+
assert len(caplog.records) == 3
244244
record = caplog.records[0]
245245
assert record.levelname == "DEBUG"
246246
assert record.message.splitlines() == [
247247
"Getting page https://user:****@example.com/simple/",
248248
]
249249
record = caplog.records[1]
250250
assert record.levelname == "DEBUG"
251+
assert record.message.splitlines() == ["headers: None"]
252+
record = caplog.records[2]
253+
assert record.levelname == "DEBUG"
251254
assert record.message.splitlines() == [
252255
"Fetched page https://user:****@example.com/simple/ as text/html",
253256
]
@@ -838,7 +841,7 @@ def test_get_index_content_directory_append_index(tmpdir: Path) -> None:
838841
mock_func.return_value = fake_response
839842
actual = _get_index_content(Link(dir_url), session=session)
840843
assert mock_func.mock_calls == [
841-
mock.call(expected_url, session=session),
844+
mock.call(expected_url, headers=None, session=session),
842845
], f"actual calls: {mock_func.mock_calls}"
843846

844847
assert actual is not None
@@ -957,6 +960,7 @@ def test_fetch_response(self, mock_get_simple_response: mock.Mock) -> None:
957960
# _get_simple_response().
958961
mock_get_simple_response.assert_called_once_with(
959962
url,
963+
headers=None,
960964
session=link_collector.session,
961965
)
962966

0 commit comments

Comments
 (0)