github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/cataloger/swift/parse_podfile_lock_test.go (about)

     1  package swift
     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 TestParsePodfileLock(t *testing.T) {
    13  	fixture := "test-fixtures/Podfile.lock"
    14  	locations := file.NewLocationSet(file.NewLocation(fixture))
    15  	expectedPkgs := []pkg.Package{
    16  		{
    17  			Name:         "GlossButtonNode",
    18  			Version:      "3.1.2",
    19  			PURL:         "pkg:cocoapods/GlossButtonNode@3.1.2",
    20  			Locations:    locations,
    21  			Language:     pkg.Swift,
    22  			Type:         pkg.CocoapodsPkg,
    23  			MetadataType: pkg.CocoapodsMetadataType,
    24  			Metadata: pkg.CocoapodsMetadata{
    25  				Checksum: "4ea1197a744f2fb5fb875fe31caf17ded4762e8f",
    26  			},
    27  		},
    28  		{
    29  			Name:         "PINCache",
    30  			Version:      "3.0.3",
    31  			PURL:         "pkg:cocoapods/PINCache@3.0.3",
    32  			Locations:    locations,
    33  			Language:     pkg.Swift,
    34  			Type:         pkg.CocoapodsPkg,
    35  			MetadataType: pkg.CocoapodsMetadataType,
    36  			Metadata: pkg.CocoapodsMetadata{
    37  				Checksum: "7a8fc1a691173d21dbddbf86cd515de6efa55086",
    38  			},
    39  		},
    40  		{
    41  			Name:         "PINCache/Arc-exception-safe",
    42  			Version:      "3.0.3",
    43  			PURL:         "pkg:cocoapods/PINCache/Arc-exception-safe@3.0.3",
    44  			Locations:    locations,
    45  			Language:     pkg.Swift,
    46  			Type:         pkg.CocoapodsPkg,
    47  			MetadataType: pkg.CocoapodsMetadataType,
    48  			Metadata: pkg.CocoapodsMetadata{
    49  				Checksum: "7a8fc1a691173d21dbddbf86cd515de6efa55086",
    50  			},
    51  		},
    52  		{
    53  			Name:         "PINCache/Core",
    54  			Version:      "3.0.3",
    55  			PURL:         "pkg:cocoapods/PINCache/Core@3.0.3",
    56  			Locations:    locations,
    57  			Language:     pkg.Swift,
    58  			Type:         pkg.CocoapodsPkg,
    59  			MetadataType: pkg.CocoapodsMetadataType,
    60  			Metadata: pkg.CocoapodsMetadata{
    61  				Checksum: "7a8fc1a691173d21dbddbf86cd515de6efa55086",
    62  			},
    63  		},
    64  		{
    65  			Name:         "PINOperation",
    66  			Version:      "1.2.1",
    67  			PURL:         "pkg:cocoapods/PINOperation@1.2.1",
    68  			Locations:    locations,
    69  			Language:     pkg.Swift,
    70  			Type:         pkg.CocoapodsPkg,
    71  			MetadataType: pkg.CocoapodsMetadataType,
    72  			Metadata: pkg.CocoapodsMetadata{
    73  				Checksum: "00c935935f1e8cf0d1e2d6b542e75b88fc3e5e20",
    74  			},
    75  		},
    76  		{
    77  			Name:         "PINRemoteImage/Core",
    78  			Version:      "3.0.3",
    79  			PURL:         "pkg:cocoapods/PINRemoteImage/Core@3.0.3",
    80  			Locations:    locations,
    81  			Language:     pkg.Swift,
    82  			Type:         pkg.CocoapodsPkg,
    83  			MetadataType: pkg.CocoapodsMetadataType,
    84  			Metadata: pkg.CocoapodsMetadata{
    85  				Checksum: "f1295b29f8c5e640e25335a1b2bd9d805171bd01",
    86  			},
    87  		},
    88  		{
    89  			Name:         "PINRemoteImage/iOS",
    90  			Version:      "3.0.3",
    91  			PURL:         "pkg:cocoapods/PINRemoteImage/iOS@3.0.3",
    92  			Locations:    locations,
    93  			Language:     pkg.Swift,
    94  			Type:         pkg.CocoapodsPkg,
    95  			MetadataType: pkg.CocoapodsMetadataType,
    96  			Metadata: pkg.CocoapodsMetadata{
    97  				Checksum: "f1295b29f8c5e640e25335a1b2bd9d805171bd01",
    98  			},
    99  		},
   100  		{
   101  			Name:         "PINRemoteImage/PINCache",
   102  			Version:      "3.0.3",
   103  			PURL:         "pkg:cocoapods/PINRemoteImage/PINCache@3.0.3",
   104  			Locations:    locations,
   105  			Language:     pkg.Swift,
   106  			Type:         pkg.CocoapodsPkg,
   107  			MetadataType: pkg.CocoapodsMetadataType,
   108  			Metadata: pkg.CocoapodsMetadata{
   109  				Checksum: "f1295b29f8c5e640e25335a1b2bd9d805171bd01",
   110  			},
   111  		},
   112  		{
   113  			Name:         "Reveal-SDK",
   114  			Version:      "33",
   115  			PURL:         "pkg:cocoapods/Reveal-SDK@33",
   116  			Locations:    locations,
   117  			Language:     pkg.Swift,
   118  			Type:         pkg.CocoapodsPkg,
   119  			MetadataType: pkg.CocoapodsMetadataType,
   120  			Metadata: pkg.CocoapodsMetadata{
   121  				Checksum: "effba1c940b8337195563c425a6b5862ec875caa",
   122  			},
   123  		},
   124  		{
   125  			Name:         "SwiftGen",
   126  			Version:      "6.5.1",
   127  			PURL:         "pkg:cocoapods/SwiftGen@6.5.1",
   128  			Locations:    locations,
   129  			Language:     pkg.Swift,
   130  			Type:         pkg.CocoapodsPkg,
   131  			MetadataType: pkg.CocoapodsMetadataType,
   132  			Metadata: pkg.CocoapodsMetadata{
   133  				Checksum: "a6d22010845f08fe18fbdf3a07a8e380fd22e0ea",
   134  			},
   135  		},
   136  		{
   137  			Name:         "Texture",
   138  			Version:      "3.1.0",
   139  			PURL:         "pkg:cocoapods/Texture@3.1.0",
   140  			Locations:    locations,
   141  			Language:     pkg.Swift,
   142  			Type:         pkg.CocoapodsPkg,
   143  			MetadataType: pkg.CocoapodsMetadataType,
   144  			Metadata: pkg.CocoapodsMetadata{
   145  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   146  			},
   147  		},
   148  		{
   149  			Name:         "Texture/AssetsLibrary",
   150  			Version:      "3.1.0",
   151  			PURL:         "pkg:cocoapods/Texture/AssetsLibrary@3.1.0",
   152  			Locations:    locations,
   153  			Language:     pkg.Swift,
   154  			Type:         pkg.CocoapodsPkg,
   155  			MetadataType: pkg.CocoapodsMetadataType,
   156  			Metadata: pkg.CocoapodsMetadata{
   157  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   158  			},
   159  		},
   160  		{
   161  			Name:         "Texture/Core",
   162  			Version:      "3.1.0",
   163  			PURL:         "pkg:cocoapods/Texture/Core@3.1.0",
   164  			Locations:    locations,
   165  			Language:     pkg.Swift,
   166  			Type:         pkg.CocoapodsPkg,
   167  			MetadataType: pkg.CocoapodsMetadataType,
   168  			Metadata: pkg.CocoapodsMetadata{
   169  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   170  			},
   171  		},
   172  		{
   173  			Name:         "Texture/MapKit",
   174  			Version:      "3.1.0",
   175  			PURL:         "pkg:cocoapods/Texture/MapKit@3.1.0",
   176  			Locations:    locations,
   177  			Language:     pkg.Swift,
   178  			Type:         pkg.CocoapodsPkg,
   179  			MetadataType: pkg.CocoapodsMetadataType,
   180  			Metadata: pkg.CocoapodsMetadata{
   181  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   182  			},
   183  		},
   184  		{
   185  			Name:         "Texture/Photos",
   186  			Version:      "3.1.0",
   187  			PURL:         "pkg:cocoapods/Texture/Photos@3.1.0",
   188  			Locations:    locations,
   189  			Language:     pkg.Swift,
   190  			Type:         pkg.CocoapodsPkg,
   191  			MetadataType: pkg.CocoapodsMetadataType,
   192  			Metadata: pkg.CocoapodsMetadata{
   193  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   194  			},
   195  		},
   196  		{
   197  			Name:         "Texture/PINRemoteImage",
   198  			Version:      "3.1.0",
   199  			PURL:         "pkg:cocoapods/Texture/PINRemoteImage@3.1.0",
   200  			Locations:    locations,
   201  			Language:     pkg.Swift,
   202  			Type:         pkg.CocoapodsPkg,
   203  			MetadataType: pkg.CocoapodsMetadataType,
   204  			Metadata: pkg.CocoapodsMetadata{
   205  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   206  			},
   207  		},
   208  		{
   209  			Name:         "Texture/Video",
   210  			Version:      "3.1.0",
   211  			PURL:         "pkg:cocoapods/Texture/Video@3.1.0",
   212  			Locations:    locations,
   213  			Language:     pkg.Swift,
   214  			Type:         pkg.CocoapodsPkg,
   215  			MetadataType: pkg.CocoapodsMetadataType,
   216  			Metadata: pkg.CocoapodsMetadata{
   217  				Checksum: "2e8ab2519452515f7f5a520f5a8f7e0a413abfa3",
   218  			},
   219  		},
   220  		{
   221  			Name:         "TextureSwiftSupport",
   222  			Version:      "3.13.0",
   223  			PURL:         "pkg:cocoapods/TextureSwiftSupport@3.13.0",
   224  			Locations:    locations,
   225  			Language:     pkg.Swift,
   226  			Type:         pkg.CocoapodsPkg,
   227  			MetadataType: pkg.CocoapodsMetadataType,
   228  			Metadata: pkg.CocoapodsMetadata{
   229  				Checksum: "c515c7927fab92d0d9485f49b885b8c5de34fbfb",
   230  			},
   231  		},
   232  		{
   233  			Name:         "TextureSwiftSupport/Components",
   234  			Version:      "3.13.0",
   235  			PURL:         "pkg:cocoapods/TextureSwiftSupport/Components@3.13.0",
   236  			Locations:    locations,
   237  			Language:     pkg.Swift,
   238  			Type:         pkg.CocoapodsPkg,
   239  			MetadataType: pkg.CocoapodsMetadataType,
   240  			Metadata: pkg.CocoapodsMetadata{
   241  				Checksum: "c515c7927fab92d0d9485f49b885b8c5de34fbfb",
   242  			},
   243  		},
   244  		{
   245  			Name:         "TextureSwiftSupport/Experiments",
   246  			Version:      "3.13.0",
   247  			PURL:         "pkg:cocoapods/TextureSwiftSupport/Experiments@3.13.0",
   248  			Locations:    locations,
   249  			Language:     pkg.Swift,
   250  			Type:         pkg.CocoapodsPkg,
   251  			MetadataType: pkg.CocoapodsMetadataType,
   252  			Metadata: pkg.CocoapodsMetadata{
   253  				Checksum: "c515c7927fab92d0d9485f49b885b8c5de34fbfb",
   254  			},
   255  		},
   256  		{
   257  			Name:         "TextureSwiftSupport/Extensions",
   258  			Version:      "3.13.0",
   259  			PURL:         "pkg:cocoapods/TextureSwiftSupport/Extensions@3.13.0",
   260  			Locations:    locations,
   261  			Language:     pkg.Swift,
   262  			Type:         pkg.CocoapodsPkg,
   263  			MetadataType: pkg.CocoapodsMetadataType,
   264  			Metadata: pkg.CocoapodsMetadata{
   265  				Checksum: "c515c7927fab92d0d9485f49b885b8c5de34fbfb",
   266  			},
   267  		},
   268  		{
   269  			Name:         "TextureSwiftSupport/LayoutSpecBuilders",
   270  			Version:      "3.13.0",
   271  			PURL:         "pkg:cocoapods/TextureSwiftSupport/LayoutSpecBuilders@3.13.0",
   272  			Locations:    locations,
   273  			Language:     pkg.Swift,
   274  			Type:         pkg.CocoapodsPkg,
   275  			MetadataType: pkg.CocoapodsMetadataType,
   276  			Metadata: pkg.CocoapodsMetadata{
   277  				Checksum: "c515c7927fab92d0d9485f49b885b8c5de34fbfb",
   278  			},
   279  		},
   280  		{
   281  			Name:         "TinyConstraints",
   282  			Version:      "4.0.2",
   283  			PURL:         "pkg:cocoapods/TinyConstraints@4.0.2",
   284  			Locations:    locations,
   285  			Language:     pkg.Swift,
   286  			Type:         pkg.CocoapodsPkg,
   287  			MetadataType: pkg.CocoapodsMetadataType,
   288  			Metadata: pkg.CocoapodsMetadata{
   289  				Checksum: "7b7ccc0c485bb3bb47082138ff28bc33cd49897f",
   290  			},
   291  		},
   292  	}
   293  
   294  	// TODO: no relationships are under test yet
   295  	var expectedRelationships []artifact.Relationship
   296  
   297  	pkgtest.TestFileParser(t, fixture, parsePodfileLock, expectedPkgs, expectedRelationships)
   298  }