From 85d93f294ffdfb4e3ff75905f141e9e762257028 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 13 Nov 2026 17:59:20 +0000 Subject: [PATCH] test(registry): mock the redirect-safe opener in the manifest digest test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The manifest digest test from #1741 patched urllib.request.urlopen, which this branch no longer calls: registry requests go through OPENER.open so a redirect cannot carry the token to another host. The unpatched opener hit the network and the test read None. It now patches OPENER.open like every other request test of the file. 🎯 Fix: 95 % 💥 Break: 1 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 94 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 --- tests/unit/python/utils/docker/test_registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/python/utils/docker/test_registry.py b/tests/unit/python/utils/docker/test_registry.py index 44da87b0af..eb36c74e0f 100644 --- a/tests/unit/python/utils/docker/test_registry.py +++ b/tests/unit/python/utils/docker/test_registry.py @@ -112,8 +112,8 @@ class TestManifestDigest(unittest.TestCase): def test_returns_the_content_digest_of_a_head_request(self) -> None: with mock.patch.object( - registry.urllib.request, - "urlopen", + registry.OPENER, + "open", return_value=_Resp(status=200, headers={"Docker-Content-Digest": HEAD}), ) as opened: digest = registry.manifest_digest("roundcube/roundcubemail", "1.7.5-apache")