-
-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75a7f41
commit 614d721
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package proposesolution_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/securego/gosec/v2/issue" | ||
"github.com/securego/gosec/v2/proposesolution" | ||
) | ||
|
||
func TestGenerateSolution(t *testing.T) { | ||
aiApiProvider := proposesolution.GeminiProvider | ||
aiApiKey := "test-api-key" // Replace with a valid API key for actual testing | ||
|
||
issues := []*issue.Issue{ | ||
{ | ||
What: "Blocklisted import crypto/md5: weak cryptographic primitive", | ||
}, | ||
} | ||
|
||
err := proposesolution.GenerateSolution(aiApiProvider, aiApiKey, issues) | ||
if err != nil { | ||
t.Fatalf("Expected no error, got %v", err) | ||
} | ||
|
||
for _, issue := range issues { | ||
if issue.ProposedSolution == "" { | ||
t.Errorf("Expected a proposed solution, got an empty string") | ||
} | ||
} | ||
} |