Skip to content

Commit 5830ea0

Browse files
fix test failures
1 parent 3fadea9 commit 5830ea0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/unit/test_collector.py

Lines changed: 10 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,19 @@ 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() == [
252+
"headers: None"
253+
]
254+
record = caplog.records[2]
255+
assert record.levelname == "DEBUG"
251256
assert record.message.splitlines() == [
252257
"Fetched page https://user:****@example.com/simple/ as text/html",
253258
]
@@ -838,7 +843,7 @@ def test_get_index_content_directory_append_index(tmpdir: Path) -> None:
838843
mock_func.return_value = fake_response
839844
actual = _get_index_content(Link(dir_url), session=session)
840845
assert mock_func.mock_calls == [
841-
mock.call(expected_url, session=session),
846+
mock.call(expected_url, headers=None, session=session),
842847
], f"actual calls: {mock_func.mock_calls}"
843848

844849
assert actual is not None
@@ -957,6 +962,7 @@ def test_fetch_response(self, mock_get_simple_response: mock.Mock) -> None:
957962
# _get_simple_response().
958963
mock_get_simple_response.assert_called_once_with(
959964
url,
965+
headers=None,
960966
session=link_collector.session,
961967
)
962968

0 commit comments

Comments
 (0)