|
34 | 34 | } }, |
35 | 35 | ])) |
36 | 36 | end |
| 37 | + let(:fake_result_json_resp_multi_subject) do |
| 38 | + instance_double(SystemCommand::Result, |
| 39 | + stdout: JSON.dump([ |
| 40 | + { verificationResult: { |
| 41 | + verifiedTimestamps: [{ timestamp: "2024-03-13T00:00:00Z" }], |
| 42 | + statement: { subject: [{ name: "nonsense" }, { name: fake_bottle_filename.to_s }] }, |
| 43 | + } }, |
| 44 | + ])) |
| 45 | + end |
37 | 46 | let(:fake_result_json_resp_backfill) do |
38 | 47 | digest = Digest::SHA256.hexdigest(fake_bottle_url) |
39 | 48 | instance_double(SystemCommand::Result, |
|
234 | 243 | described_class.check_core_attestation fake_bottle |
235 | 244 | end |
236 | 245 |
|
| 246 | + it "calls gh with args for homebrew-core and handles a multi-subject attestation" do |
| 247 | + expect(described_class).to receive(:system_command!) |
| 248 | + .with(fake_gh, args: ["attestation", "verify", cached_download, "--repo", |
| 249 | + described_class::HOMEBREW_CORE_REPO, "--format", "json"], |
| 250 | + env: { "GH_TOKEN" => fake_gh_creds, "GH_HOST" => "github.com" }, secrets: [fake_gh_creds], |
| 251 | + print_stderr: false, chdir: HOMEBREW_TEMP) |
| 252 | + .and_return(fake_result_json_resp_multi_subject) |
| 253 | + |
| 254 | + described_class.check_core_attestation fake_bottle |
| 255 | + end |
| 256 | + |
237 | 257 | it "calls gh with args for backfill when homebrew-core attestation is missing" do |
238 | 258 | expect(described_class).to receive(:system_command!) |
239 | 259 | .with(fake_gh, args: ["attestation", "verify", cached_download, "--repo", |
|
0 commit comments