@@ -832,7 +832,6 @@ func TestAddSCSScan_ResubmitWithoutScorecardFlags_ShouldPass(t *testing.T) {
832832
833833 for _ , tt := range tests {
834834 t .Run (tt .name , func (t * testing.T ) {
835- wrappers .ClearCache ()
836835 cmdCommand := & cobra.Command {
837836 Use : "scan" ,
838837 Short : "Scan a project" ,
@@ -908,7 +907,6 @@ func TestAddSCSScan_ResubmitWithScorecardFlags_ShouldPass(t *testing.T) {
908907
909908 for _ , tt := range tests {
910909 t .Run (tt .name , func (t * testing.T ) {
911- wrappers .ClearCache ()
912910 cmdCommand := & cobra.Command {
913911 Use : "scan" ,
914912 Short : "Scan a project" ,
@@ -1199,7 +1197,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecard_scsMapHasBoth(t *testing.
11991197
12001198 for _ , tt := range tests {
12011199 t .Run (tt .name , func (t * testing.T ) {
1202- wrappers .ClearCache ()
12031200 var resubmitConfig []wrappers.Config
12041201 cmdCommand := & cobra.Command {
12051202 Use : "scan" ,
@@ -1266,7 +1263,6 @@ func TestAddSCSScan_WithoutSCSSecretDetection_scsMapNoSecretDetection(t *testing
12661263
12671264 for _ , tt := range tests {
12681265 t .Run (tt .name , func (t * testing.T ) {
1269- wrappers .ClearCache ()
12701266 var resubmitConfig []wrappers.Config
12711267 cmdCommand := & cobra.Command {
12721268 Use : "scan" ,
@@ -1333,7 +1329,6 @@ func TestAddSCSScan_WithSCSSecretDetection_scsMapHasSecretDetection(t *testing.T
13331329
13341330 for _ , tt := range tests {
13351331 t .Run (tt .name , func (t * testing.T ) {
1336- wrappers .ClearCache ()
13371332 var resubmitConfig []wrappers.Config
13381333 cmdCommand := & cobra.Command {
13391334 Use : "scan" ,
@@ -1398,7 +1393,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndGitCommitHistoryFlag_scsMapHasSecre
13981393
13991394 for _ , tt := range tests {
14001395 t .Run (tt .name , func (t * testing.T ) {
1401- wrappers .ClearCache ()
14021396 var resubmitConfig []wrappers.Config
14031397 cmdCommand := & cobra.Command {
14041398 Use : "scan" ,
@@ -1426,9 +1420,7 @@ func TestAddSCSScan_WithSCSSecretDetectionAndGitCommitHistoryFlag_scsMapHasSecre
14261420 Status : true ,
14271421 },
14281422 }
1429- defer func () {
1430- mock .Flags = wrappers.FeatureFlagsResponseModel {}
1431- }()
1423+ defer clearFlags ()
14321424
14331425 featureFlagsWrapper := & mock.FeatureFlagsMockWrapper {}
14341426 result , _ := addSCSScan (cmdCommand , resubmitConfig ,
@@ -1475,7 +1467,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardWithScanTypesAndNoScorecar
14751467
14761468 for _ , tt := range tests {
14771469 t .Run (tt .name , func (t * testing.T ) {
1478- wrappers .ClearCache ()
14791470 // Create a pipe for capturing stdout
14801471 r , w , _ := os .Pipe ()
14811472 oldStdout := os .Stdout
@@ -1557,7 +1548,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndWithoutScanTypes_scsMapHasSecretDet
15571548
15581549 for _ , tt := range tests {
15591550 t .Run (tt .name , func (t * testing.T ) {
1560- wrappers .ClearCache ()
15611551 var resubmitConfig []wrappers.Config
15621552 cmdCommand := & cobra.Command {
15631553 Use : "scan" ,
@@ -1615,7 +1605,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardShortenedGithubRepo_scsMap
16151605
16161606 for _ , tt := range tests {
16171607 t .Run (tt .name , func (t * testing.T ) {
1618- wrappers .ClearCache ()
16191608 // Create a pipe for capturing stdout
16201609 r , w , _ := os .Pipe ()
16211610 oldStdout := os .Stdout
@@ -1703,7 +1692,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardShortenedGithubRepoWithTok
17031692
17041693 for _ , tt := range tests {
17051694 t .Run (tt .name , func (t * testing.T ) {
1706- wrappers .ClearCache ()
17071695 // Create a pipe for capturing stdout
17081696 r , w , _ := os .Pipe ()
17091697 oldStdout := os .Stdout
@@ -1791,7 +1779,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardGithubRepoWithTokenInURL_s
17911779
17921780 for _ , tt := range tests {
17931781 t .Run (tt .name , func (t * testing.T ) {
1794- wrappers .ClearCache ()
17951782 // Create a pipe for capturing stdout
17961783 r , w , _ := os .Pipe ()
17971784 oldStdout := os .Stdout
@@ -1878,7 +1865,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardGithubRepoWithTokenAndUser
18781865 }
18791866
18801867 for _ , tt := range tests {
1881- wrappers .ClearCache ()
18821868 t .Run (tt .name , func (t * testing.T ) {
18831869 // Create a pipe for capturing stdout
18841870 r , w , _ := os .Pipe ()
@@ -1966,7 +1952,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardShortenedGithubRepoWithTok
19661952 }
19671953
19681954 for _ , tt := range tests {
1969- wrappers .ClearCache ()
19701955 t .Run (tt .name , func (t * testing.T ) {
19711956 // Create a pipe for capturing stdout
19721957 r , w , _ := os .Pipe ()
@@ -2054,7 +2039,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardGitLabRepo_scsMapHasSecret
20542039 }
20552040
20562041 for _ , tt := range tests {
2057- wrappers .ClearCache ()
20582042 t .Run (tt .name , func (t * testing.T ) {
20592043 // Create a pipe for capturing stdout
20602044 r , w , _ := os .Pipe ()
@@ -2143,7 +2127,6 @@ func TestAddSCSScan_WithSCSSecretDetectionAndScorecardGitSSHRepo_scsMapHasSecret
21432127
21442128 for _ , tt := range tests {
21452129 t .Run (tt .name , func (t * testing.T ) {
2146- wrappers .ClearCache ()
21472130 // Create a pipe for capturing stdout
21482131 r , w , _ := os .Pipe ()
21492132 oldStdout := os .Stdout
@@ -3553,7 +3536,6 @@ func TestValidateScanTypes(t *testing.T) {
35533536
35543537 for _ , tt := range tests {
35553538 t .Run (tt .name , func (t * testing.T ) {
3556- wrappers .ClearCache ()
35573539 mock .Flag = wrappers.FeatureFlagResponseModel {
35583540 Name : wrappers .ScsLicensingV2Enabled ,
35593541 Status : tt .scsLicensingV2 ,
0 commit comments