@@ -40,7 +40,50 @@ def test_fix_bundle_fixes_missing_checkpoint(capsys, sigstore, asset):
40
40
# The bundle now loads correctly.
41
41
bundle = Bundle .from_json (captures .out )
42
42
43
- # ...and can now be used to verify the `Python-3.12.5.tgz` release.
43
+ # We didn't pass `--upgrade-version` so the version is still v0.1.
44
+ assert bundle ._inner .media_type == Bundle .BundleType .BUNDLE_0_1
45
+
46
+ # ...and the fixed bundle can now be used to verify the `Python-3.12.5.tgz`
47
+ # release.
48
+ verifier = Verifier .production ()
49
+ verifier .verify_artifact (
50
+ Hashed (
51
+ algorithm = HashAlgorithm .SHA2_256 ,
52
+ digest = bytes .fromhex (
53
+ "38dc4e2c261d49c661196066edbfb70fdb16be4a79cc8220c224dfeb5636d405"
54
+ ),
55
+ ),
56
+ bundle ,
57
+ policy .AllOf (
58
+ [
59
+ policy .Identity (
60
+ identity = "thomas@python.org" , issuer = "https://accounts.google.com"
61
+ )
62
+ ]
63
+ ),
64
+ )
65
+
66
+
67
+ def test_fix_bundle_upgrades_bundle (capsys , sigstore , asset ):
68
+ invalid_bundle = asset ("Python-3.12.5.tgz.sigstore" )
69
+
70
+ # Running `sigstore plumbing fix-bundle --upgrade-version`
71
+ # emits a fixed bundle.
72
+ sigstore (
73
+ "plumbing" , "fix-bundle" , "--upgrade-version" , "--bundle" , str (invalid_bundle )
74
+ )
75
+
76
+ captures = capsys .readouterr ()
77
+
78
+ # The bundle now loads correctly.
79
+ bundle = Bundle .from_json (captures .out )
80
+
81
+ # The bundle is now the latest version (v0.3).
82
+ assert bundle ._inner .media_type == Bundle .BundleType .BUNDLE_0_3
83
+
84
+ # ...and the upgraded (and fixed) bundle can still verify
85
+ # the release.
86
+ # ...and the fixed can now be used to verify the `Python-3.12.5.tgz` release.
44
87
verifier = Verifier .production ()
45
88
verifier .verify_artifact (
46
89
Hashed (
0 commit comments