Point the iptables tests at the module that now holds the code

aecfd1a moved _block_store_iptables into _store_iptables but left its tests
patching store_blocker.socket, which no longer exists there. My mistake: I
read a --no-cov run as green when it was not, and committed 3 failures.

1347 tests, 100.00% coverage, verified with the coverage run this time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016A1EYiv7e7HGhET84oa9M3
This commit is contained in:
Krzysztof Rudnicki 2026-08-24 15:07:58 +02:00
parent aecfd1a3a0
commit 8f010cfe46

View File

@ -171,11 +171,11 @@ class TestBlockStoreIptables:
mock_result = MagicMock(returncode=0)
with (
patch(
"steam_backlog_enforcer.store_blocker.subprocess.run",
"steam_backlog_enforcer._store_iptables.subprocess.run",
return_value=mock_result,
),
patch(
"steam_backlog_enforcer.store_blocker.socket.getaddrinfo",
"steam_backlog_enforcer._store_iptables.socket.getaddrinfo",
return_value=[
(None, None, None, None, ("1.2.3.4", 443)),
],
@ -186,7 +186,7 @@ class TestBlockStoreIptables:
def test_os_error(self) -> None:
"""Test os error."""
with patch(
"steam_backlog_enforcer.store_blocker.subprocess.run",
"steam_backlog_enforcer._store_iptables.subprocess.run",
side_effect=OSError,
):
assert _block_store_iptables() is False
@ -198,11 +198,11 @@ class TestBlockStoreIptables:
mock_result = MagicMock(returncode=0)
with (
patch(
"steam_backlog_enforcer.store_blocker.subprocess.run",
"steam_backlog_enforcer._store_iptables.subprocess.run",
return_value=mock_result,
),
patch(
"steam_backlog_enforcer.store_blocker.socket.getaddrinfo",
"steam_backlog_enforcer._store_iptables.socket.getaddrinfo",
side_effect=socket.gaierror,
),
):
@ -228,11 +228,11 @@ class TestBlockStoreIptables:
with (
patch(
"steam_backlog_enforcer.store_blocker.subprocess.run",
"steam_backlog_enforcer._store_iptables.subprocess.run",
side_effect=side_effect,
),
patch(
"steam_backlog_enforcer.store_blocker.socket.getaddrinfo",
"steam_backlog_enforcer._store_iptables.socket.getaddrinfo",
side_effect=__import__("socket").gaierror,
),
):