mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
test(registry): mock the redirect-safe opener in the manifest digest test
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
dba4b62771
commit
85d93f294f
1 file changed
+2
-2
@@ -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")
|
||||
|
||||
Reference in new issue
Block a user