github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/cataloger/python/parse_poetry_lock_test.go (about) 1 package python 2 3 import ( 4 "testing" 5 6 "github.com/anchore/syft/syft/artifact" 7 "github.com/anchore/syft/syft/file" 8 "github.com/anchore/syft/syft/pkg" 9 "github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest" 10 ) 11 12 func TestParsePoetryLock(t *testing.T) { 13 fixture := "test-fixtures/poetry/poetry.lock" 14 locations := file.NewLocationSet(file.NewLocation(fixture)) 15 expectedPkgs := []pkg.Package{ 16 { 17 Name: "added-value", 18 Version: "0.14.2", 19 PURL: "pkg:pypi/added-value@0.14.2", 20 Locations: locations, 21 Language: pkg.Python, 22 Type: pkg.PythonPkg, 23 }, 24 { 25 Name: "alabaster", 26 Version: "0.7.12", 27 PURL: "pkg:pypi/alabaster@0.7.12", 28 Locations: locations, 29 Language: pkg.Python, 30 Type: pkg.PythonPkg, 31 }, 32 { 33 Name: "appnope", 34 Version: "0.1.0", 35 PURL: "pkg:pypi/appnope@0.1.0", 36 Locations: locations, 37 Language: pkg.Python, 38 Type: pkg.PythonPkg, 39 }, 40 { 41 Name: "asciitree", 42 Version: "0.3.3", 43 PURL: "pkg:pypi/asciitree@0.3.3", 44 Locations: locations, 45 Language: pkg.Python, 46 Type: pkg.PythonPkg, 47 }, 48 } 49 50 // TODO: relationships are not under test 51 var expectedRelationships []artifact.Relationship 52 53 pkgtest.TestFileParser(t, fixture, parsePoetryLock, expectedPkgs, expectedRelationships) 54 }