@@ -123,6 +123,49 @@ func Test_verifyAssetRun_Success(t *testing.T) {
123123 require .NoError (t , err )
124124}
125125
126+ func Test_verifyAssetRun_SuccessNoTagArg (t * testing.T ) {
127+ ios , _ , _ , _ := iostreams .Test ()
128+ tagName := "v6"
129+
130+ fakeHTTP := & httpmock.Registry {}
131+ defer fakeHTTP .Verify (t )
132+ fakeSHA := "1234567890abcdef1234567890abcdef12345678"
133+ shared .StubFetchRefSHA (t , fakeHTTP , "OWNER" , "REPO" , tagName , fakeSHA )
134+ shared .StubFetchRelease (t , fakeHTTP , "OWNER" , "REPO" , "" , `{
135+ "tag_name": "v6",
136+ "draft": false,
137+ "url": "https://api.github.com/repos/OWNER/REPO/releases/23456"
138+ }` )
139+
140+ baseRepo , err := ghrepo .FromFullName ("OWNER/REPO" )
141+ require .NoError (t , err )
142+ result := & verification.AttestationProcessingResult {
143+ Attestation : & api.Attestation {
144+ Bundle : data .GitHubReleaseBundle (t ),
145+ BundleURL : "https://example.com" ,
146+ },
147+ VerificationResult : nil ,
148+ }
149+
150+ releaseAssetPath := test .NormalizeRelativePath ("../../attestation/test/data/github_release_artifact.zip" )
151+
152+ cfg := & VerifyAssetConfig {
153+ Opts : & VerifyAssetOptions {
154+ AssetFilePath : releaseAssetPath ,
155+ TagName : "" , // No tag argument provided
156+ BaseRepo : baseRepo ,
157+ Exporter : nil ,
158+ },
159+ IO : ios ,
160+ HttpClient : & http.Client {Transport : fakeHTTP },
161+ AttClient : api .NewTestClient (),
162+ AttVerifier : shared .NewMockVerifier (result ),
163+ }
164+
165+ err = verifyAssetRun (cfg )
166+ require .NoError (t , err )
167+ }
168+
126169func Test_verifyAssetRun_FailedNoAttestations (t * testing.T ) {
127170 ios , _ , _ , _ := iostreams .Test ()
128171 tagName := "v1"
0 commit comments