MCPcopy
hub / github.com/cli/cli / Test_verifyRun_Success

Function Test_verifyRun_Success

pkg/cmd/release/verify/verify_test.go:72–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func Test_verifyRun_Success(t *testing.T) {
73 ios, _, _, _ := iostreams.Test()
74 tagName := "v6"
75
76 fakeHTTP := &httpmock.Registry{}
77 defer fakeHTTP.Verify(t)
78
79 fakeSHA := "1234567890abcdef1234567890abcdef12345678"
80 shared.StubFetchRefSHA(t, fakeHTTP, "owner", "repo", tagName, fakeSHA)
81
82 baseRepo, err := ghrepo.FromFullName("owner/repo")
83 require.NoError(t, err)
84
85 result := &verification.AttestationProcessingResult{
86 Attestation: &api.Attestation{
87 Bundle: data.GitHubReleaseBundle(t),
88 BundleURL: "https://example.com",
89 },
90 VerificationResult: nil,
91 }
92
93 cfg := &VerifyConfig{
94 Opts: &VerifyOptions{
95 TagName: tagName,
96 BaseRepo: baseRepo,
97 Exporter: nil,
98 },
99 IO: ios,
100 HttpClient: &http.Client{Transport: fakeHTTP},
101 AttClient: api.NewTestClient(),
102 AttVerifier: shared.NewMockVerifier(result),
103 }
104
105 err = verifyRun(cfg)
106 require.NoError(t, err)
107}
108
109func Test_verifyRun_FailedNoAttestations_SHA1(t *testing.T) {
110 ios, _, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
TestFunction · 0.92
StubFetchRefSHAFunction · 0.92
FromFullNameFunction · 0.92
GitHubReleaseBundleFunction · 0.92
NewTestClientFunction · 0.92
NewMockVerifierFunction · 0.92
verifyRunFunction · 0.85

Tested by

no test coverage detected