@@ -2373,3 +2373,48 @@ func TestCreateScan_WithScaResolver_ZipSource_Fail(t *testing.T) {
23732373 err , _ := executeCommand (t , args ... )
23742374 assert .Error (t , err , "Scanning Zip files is not supported by ScaResolver.Please use non-zip source" )
23752375}
2376+
2377+ func TestCreateScan_SbomScanForInvalidScanTypes (t * testing.T ) {
2378+ args := []string {
2379+ "scan" , "create" ,
2380+ flag (params .ProjectName ), "random_proj" ,
2381+ flag (params .SourcesFlag ), "data/project-with-directory-symlink" ,
2382+ flag (params .ScanTypes ), "sast,sca" ,
2383+ flag (params .BranchFlag ), "dummy_branch" ,
2384+ flag (params .SbomFlag ),
2385+ }
2386+
2387+ err , _ := executeCommand (t , args ... )
2388+ assert .Error (t , err , "The --sbom-only flag can only be used with scan type: sca" )
2389+
2390+ }
2391+
2392+ func TestCreateScan_SbomScanForInvalidFileExtension (t * testing.T ) {
2393+ args := []string {
2394+ "scan" , "create" ,
2395+ flag (params .ProjectName ), "random_proj" ,
2396+ flag (params .SourcesFlag ), "data/project-with-directory-symlink" ,
2397+ flag (params .ScanTypes ), "sca" ,
2398+ flag (params .BranchFlag ), "dummy_branch" ,
2399+ flag (params .SbomFlag ),
2400+ }
2401+
2402+ err , _ := executeCommand (t , args ... )
2403+ assert .Error (t , err , "Failed creating a scan: Input in bad format: not a JSON/XML file, provide valid JSON/XMl file" )
2404+
2405+ }
2406+
2407+ func TestCreateScan_SbomScanForNotExistingFile (t * testing.T ) {
2408+ args := []string {
2409+ "scan" , "create" ,
2410+ flag (params .ProjectName ), "random_proj" ,
2411+ flag (params .SourcesFlag ), "data/sbom.json" ,
2412+ flag (params .ScanTypes ), "sca" ,
2413+ flag (params .BranchFlag ), "dummy_branch" ,
2414+ flag (params .SbomFlag ),
2415+ }
2416+
2417+ err , _ := executeCommand (t , args ... )
2418+ assert .ErrorContains (t , err , "Failed creating a scan: Input in bad format: failed to read file:" )
2419+
2420+ }
0 commit comments