github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/pkg/cataloger/python/parse_pipfile_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/lineaje-labs/syft/syft/pkg/cataloger/internal/pkgtest" 10 ) 11 12 func TestParsePipFileLock(t *testing.T) { 13 14 fixture := "test-fixtures/pipfile-lock/Pipfile.lock" 15 locations := file.NewLocationSet(file.NewLocation(fixture)) 16 expectedPkgs := []pkg.Package{ 17 { 18 Name: "aio-pika", 19 Version: "6.8.0", 20 PURL: "pkg:pypi/aio-pika@6.8.0", 21 Locations: locations, 22 Language: pkg.Python, 23 Type: pkg.PythonPkg, 24 Metadata: pkg.PythonPipfileLockEntry{ 25 Index: "https://pypi.org/simple", 26 Hashes: []string{ 27 "sha256:1d4305a5f78af3857310b4fe48348cdcf6c097e0e275ea88c2cd08570531a369", 28 "sha256:e69afef8695f47c5d107bbdba21bdb845d5c249acb3be53ef5c2d497b02657c0", 29 }}, 30 }, 31 { 32 Name: "aiodns", 33 Version: "2.0.0", 34 PURL: "pkg:pypi/aiodns@2.0.0", 35 Locations: locations, 36 Language: pkg.Python, 37 Type: pkg.PythonPkg, 38 Metadata: pkg.PythonPipfileLockEntry{ 39 Index: "https://test.pypi.org/simple", 40 Hashes: []string{ 41 "sha256:815fdef4607474295d68da46978a54481dd1e7be153c7d60f9e72773cd38d77d", 42 "sha256:aaa5ac584f40fe778013df0aa6544bf157799bd3f608364b451840ed2c8688de", 43 }, 44 }, 45 }, 46 { 47 Name: "aiohttp", 48 Version: "3.7.4.post0", 49 PURL: "pkg:pypi/aiohttp@3.7.4.post0", 50 Locations: locations, 51 Language: pkg.Python, 52 Type: pkg.PythonPkg, 53 Metadata: pkg.PythonPipfileLockEntry{ 54 Index: "https://pypi.org/simple", 55 Hashes: []string{ 56 "sha256:02f46fc0e3c5ac58b80d4d56eb0a7c7d97fcef69ace9326289fb9f1955e65cfe", 57 "sha256:0563c1b3826945eecd62186f3f5c7d31abb7391fedc893b7e2b26303b5a9f3fe", 58 }, 59 }, 60 }, 61 { 62 Name: "aiohttp-jinja2", 63 Version: "1.4.2", 64 PURL: "pkg:pypi/aiohttp-jinja2@1.4.2", 65 Locations: locations, 66 Language: pkg.Python, 67 Type: pkg.PythonPkg, 68 Metadata: pkg.PythonPipfileLockEntry{ 69 Index: "https://pypi.org/simple", 70 Hashes: []string{ 71 "sha256:860da7582efa866744bad5883947557d0f82e457d69903ea65d666b66f8a69ca", 72 "sha256:9c22a0e48e3b277fc145c67dd8c3b8f609dab36bce9eb337f70dfe716663c9a0", 73 }, 74 }, 75 }, 76 } 77 78 // TODO: relationships are not under test 79 var expectedRelationships []artifact.Relationship 80 81 pkgtest.TestFileParser(t, fixture, parsePipfileLock, expectedPkgs, expectedRelationships) 82 }