Fix tests for attestations

This commit is contained in:
Nanda H Krishna 2024-07-15 16:42:43 -04:00
parent 81e606007f
commit 8839ccfe72
No known key found for this signature in database
GPG Key ID: 067E5FCD58ADF3AA
5 changed files with 5 additions and 6 deletions

View File

@ -53,7 +53,6 @@ module Homebrew
return true if Homebrew::EnvConfig.verify_attestations?
return false if GitHub::API.credentials.blank?
return false if ENV.fetch("CI", false)
return false unless Formula["gh"].any_version_installed?
Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?
end
@ -70,7 +69,7 @@ module Homebrew
return @gh_executable if @gh_executable.present?
with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do
@gh_executable = ensure_executable!("gh")
@gh_executable = ensure_executable!("gh", reason: "verifying attestations")
gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false)
.stdout.match(/\d+(?:\.\d+)+/i).to_s)

View File

@ -267,7 +267,7 @@ module Homebrew
if formulae.include?(Formula["gh"])
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
else
Homebrew::Attestation.ensure_gh_installed!
Homebrew::Attestation.gh_executable
end
end

View File

@ -128,7 +128,7 @@ module Homebrew
if formulae.include?(Formula["gh"])
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
else
Homebrew::Attestation.ensure_gh_installed!
Homebrew::Attestation.gh_executable
end
end

View File

@ -138,7 +138,7 @@ module Homebrew
if formulae.include?(Formula["gh"])
formulae.unshift(formulae.delete(Formula["gh"]))
else
Homebrew::Attestation.ensure_gh_installed!
Homebrew::Attestation.gh_executable
end
end

View File

@ -77,7 +77,7 @@ RSpec.describe Homebrew::Attestation do
it "calls ensure_executable and ensure_formula_installed" do
expect(described_class).to receive(:ensure_executable!)
.with("gh")
.with("gh", reason: "verifying attestations")
.and_return(fake_old_gh)
expect(described_class).to receive(:ensure_formula_installed!)