@@ -1127,28 +1127,53 @@ func TestAddKicsScan(t *testing.T) {
11271127 Long : `Scan a project` ,
11281128 }
11291129
1130- cmdCommand .PersistentFlags ().String (commonParams .KicsFilterFlag , "" , "Filter for KICS scan" )
1131- cmdCommand .PersistentFlags ().Bool (commonParams .IacsPlatformsFlag , false , "IaC platforms" )
1130+ cmdCommand .PersistentFlags ().StringSlice (
1131+ commonParams .KicsFilterFlag ,
1132+ []string {},
1133+ "Filter for KICS scan" ,
1134+ )
1135+
1136+ cmdCommand .PersistentFlags ().StringSlice (
1137+ commonParams .IacsFilterFlag ,
1138+ []string {},
1139+ "IaC filter" ,
1140+ )
1141+
1142+ cmdCommand .PersistentFlags ().StringSlice (
1143+ commonParams .IacsPlatformsFlag ,
1144+ []string {},
1145+ "IaC platforms" ,
1146+ )
11321147
1148+ // Execute command to initialize flags
11331149 _ = cmdCommand .Execute ()
11341150
1151+ // Set values
11351152 _ = cmdCommand .Flags ().Set (commonParams .KicsFilterFlag , "test" )
1136- _ = cmdCommand .Flags ().Set (commonParams .IacsPlatformsFlag , "true " )
1153+ _ = cmdCommand .Flags ().Set (commonParams .IacsPlatformsFlag , "terraform " )
11371154
11381155 result := addKicsScan (cmdCommand , resubmitConfig )
11391156
1140- kicsConfig := wrappers.KicsConfig {
1141- Filter : "test" ,
1157+ expectedConfig := wrappers.KicsConfig {
1158+ Filter : "test" ,
1159+ Platforms : "terraform" ,
1160+ }
1161+
1162+ // Type assertion
1163+ if result [resultsMapType ] != commonParams .KicsType {
1164+ t .Errorf ("Expected type %s, got %v" ,
1165+ commonParams .KicsType ,
1166+ result [resultsMapType ],
1167+ )
11421168 }
1143- kicsMapConfig := make (map [string ]interface {})
1144- kicsMapConfig [resultsMapType ] = commonParams .KicsType
11451169
1146- kicsMapConfig [ resultsMapValue ] = & kicsConfig
1170+ actualConfig := result [ resultsMapValue ].( * wrappers. KicsConfig )
11471171
1148- if ! reflect .DeepEqual (result , kicsMapConfig ) {
1149- t .Errorf ("Expected %+v, but got %+v" , kicsMapConfig , result )
1172+ if ! reflect .DeepEqual (actualConfig , & expectedConfig ) {
1173+ t .Errorf ("Expected %+v, but got %+v" , expectedConfig , actualConfig )
11501174 }
11511175}
1176+
11521177func TestCreateScanProjectTagsCheckResendToScan (t * testing.T ) {
11531178 baseArgs := []string {"scan" , "create" , "--project-name" , "sastFilterMock" , "-b" , "dummy_branch" , "-s" , dummyRepo , "--project-tags" , "SEG" , "--debug" }
11541179 cmd := createASTTestCommand ()
0 commit comments