@@ -164,6 +164,73 @@ func TestWriter_Write(t *testing.T) {
164
164
},
165
165
},
166
166
},
167
+ {
168
+ name : "pypi from image" ,
169
+ report : types.Report {
170
+ SchemaVersion : 2 ,
171
+ ArtifactName : "fake_repo.azurecr.io/image_name" ,
172
+ ArtifactType : "container_image" ,
173
+ Metadata : types.Metadata {
174
+ RepoDigests : []string {"fake_repo.azurecr.io/image_name@sha256:a7c92cdcb3d010f6edeb37ddcdbacab14981aa31e7f1140e0097dc1b8e834c49" },
175
+ RepoTags : []string {"fake_repo.azurecr.io/image_name:latest" },
176
+ },
177
+ Results : types.Results {
178
+ {
179
+ Target : "Python" ,
180
+ Class : "lang-pkgs" ,
181
+ Type : "python-pkg" ,
182
+ Packages : []ftypes.Package {
183
+ {
184
+ Name : "jwcrypto" ,
185
+ Version : "0.7" ,
186
+ Licenses : []string {
187
+ "LGPLv3+" ,
188
+ },
189
+ Layer : ftypes.Layer {
190
+ Digest : "sha256:ddc612ba4e74ea5633a93e19e7c32f61f5f230073b21a070302a61ef5eec5c50" ,
191
+ DiffID : "sha256:12935ef6ce21a266aef8df75d601cebf7e935edd01e9f19fab16ccb78fbb9a5e" ,
192
+ },
193
+ FilePath : "opt/pyenv/versions/3.11.2/lib/python3.11/site-packages/jwcrypto-0.7.dist-info/METADATA" ,
194
+ },
195
+ {
196
+ Name : "matplotlib" ,
197
+ Version : "3.5.3" ,
198
+ Licenses : []string {
199
+ "PSF" ,
200
+ },
201
+ Layer : ftypes.Layer {
202
+ Digest : "sha256:ddc612ba4e74ea5633a93e19e7c32f61f5f230073b21a070302a61ef5eec5c50" ,
203
+ DiffID : "sha256:12935ef6ce21a266aef8df75d601cebf7e935edd01e9f19fab16ccb78fbb9a5e" ,
204
+ },
205
+ FilePath : "opt/pyenv/versions/3.11.2/lib/python3.11/site-packages/matplotlib-3.5.3.dist-info/METADATA" ,
206
+ },
207
+ },
208
+ },
209
+ },
210
+ },
211
+ want : map [string ]github.Manifest {
212
+ "Python" : {
213
+ Name : "python-pkg" ,
214
+ File : & github.File {
215
+ SrcLocation : "fake_repo.azurecr.io/image_name:latest@sha256:a7c92cdcb3d010f6edeb37ddcdbacab14981aa31e7f1140e0097dc1b8e834c49" ,
216
+ },
217
+ Resolved : map [string ]github.Package {
218
+ "jwcrypto" : {
219
+ PackageUrl :
"pkg:pypi/[email protected] " ,
220
+ Relationship : "direct" ,
221
+ Scope : "runtime" ,
222
+ Metadata : github.Metadata {"source_location" : "opt/pyenv/versions/3.11.2/lib/python3.11/site-packages/jwcrypto-0.7.dist-info/METADATA" },
223
+ },
224
+ "matplotlib" : {
225
+ PackageUrl :
"pkg:pypi/[email protected] " ,
226
+ Relationship : "direct" ,
227
+ Scope : "runtime" ,
228
+ Metadata : github.Metadata {"source_location" : "opt/pyenv/versions/3.11.2/lib/python3.11/site-packages/matplotlib-3.5.3.dist-info/METADATA" },
229
+ },
230
+ },
231
+ },
232
+ },
233
+ },
167
234
}
168
235
169
236
for _ , tt := range tests {
0 commit comments