update the test
This commit is contained in:
parent
9e54a6242b
commit
8d701dc13e
2 changed files with 0 additions and 73 deletions
|
|
@ -83,43 +83,6 @@ func TestNewCmdVerifyAsset_Args(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Test that Initiator is set to "github" when fetching attestations
|
||||
func Test_verifyAssetRun_InitiatorParam(t *testing.T) {
|
||||
ios, _, _, _ := iostreams.Test()
|
||||
tagName := "v6"
|
||||
|
||||
fakeHTTP := &httpmock.Registry{}
|
||||
defer fakeHTTP.Verify(t)
|
||||
fakeSHA := "1234567890abcdef1234567890abcdef12345678"
|
||||
shared.StubFetchRefSHA(t, fakeHTTP, "owner", "repo", tagName, fakeSHA)
|
||||
|
||||
baseRepo, err := ghrepo.FromFullName("owner/repo")
|
||||
require.NoError(t, err)
|
||||
|
||||
// Capture FetchParams passed to GetByDigest
|
||||
var gotParams api.FetchParams
|
||||
mockClient := &api.MockClient{
|
||||
OnGetByDigest: func(params api.FetchParams) ([]*api.Attestation, error) {
|
||||
gotParams = params
|
||||
return []*api.Attestation{}, nil
|
||||
},
|
||||
}
|
||||
|
||||
cfg := &VerifyAssetConfig{
|
||||
Opts: &VerifyAssetOptions{
|
||||
AssetFilePath: test.NormalizeRelativePath("../../attestation/test/data/github_release_artifact.zip"),
|
||||
TagName: tagName,
|
||||
BaseRepo: baseRepo,
|
||||
},
|
||||
IO: ios,
|
||||
HttpClient: &http.Client{Transport: fakeHTTP},
|
||||
AttClient: mockClient,
|
||||
AttVerifier: nil,
|
||||
}
|
||||
_ = verifyAssetRun(cfg)
|
||||
assert.Equal(t, "github", gotParams.Initiator)
|
||||
}
|
||||
|
||||
func Test_verifyAssetRun_Success(t *testing.T) {
|
||||
ios, _, _, _ := iostreams.Test()
|
||||
tagName := "v6"
|
||||
|
|
|
|||
|
|
@ -66,42 +66,6 @@ func TestNewCmdVerify_Args(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Test that Initiator is set to "github" when fetching attestations in verifyRun
|
||||
func Test_verifyRun_InitiatorParam(t *testing.T) {
|
||||
ios, _, _, _ := iostreams.Test()
|
||||
tagName := "v1.2.3"
|
||||
|
||||
fakeHTTP := &httpmock.Registry{}
|
||||
defer fakeHTTP.Verify(t)
|
||||
fakeSHA := "1234567890abcdef1234567890abcdef12345678"
|
||||
shared.StubFetchRefSHA(t, fakeHTTP, "owner", "repo", tagName, fakeSHA)
|
||||
|
||||
baseRepo, err := ghrepo.FromFullName("owner/repo")
|
||||
require.NoError(t, err)
|
||||
|
||||
// Capture FetchParams passed to GetByDigest
|
||||
var gotParams api.FetchParams
|
||||
mockClient := &api.MockClient{
|
||||
OnGetByDigest: func(params api.FetchParams) ([]*api.Attestation, error) {
|
||||
gotParams = params
|
||||
return []*api.Attestation{}, nil
|
||||
},
|
||||
}
|
||||
|
||||
cfg := &VerifyConfig{
|
||||
Opts: &VerifyOptions{
|
||||
TagName: tagName,
|
||||
BaseRepo: baseRepo,
|
||||
},
|
||||
IO: ios,
|
||||
HttpClient: &http.Client{Transport: fakeHTTP},
|
||||
AttClient: mockClient,
|
||||
}
|
||||
// Execute verifyRun, ignoring error since mockClient returns empty slice
|
||||
_ = verifyRun(cfg)
|
||||
assert.Equal(t, "github", gotParams.Initiator)
|
||||
}
|
||||
|
||||
func Test_verifyRun_Success(t *testing.T) {
|
||||
ios, _, _, _ := iostreams.Test()
|
||||
tagName := "v6"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue