Skip to content

Commit

Permalink
Fix OpenAI test (trufflesecurity#1186)
Browse files Browse the repository at this point in the history
* Add OpenAI Detector

* Add OpenAI Detector tests

* Add OpenAI Detector to defaults.go

* Removing references to github detector in tests

* update test

---------

Co-authored-by: Yassine Ilmi <Yassine.Ilmi@thomsonreuters.com>
  • Loading branch information
dustin-decker and yilmi committed Mar 27, 2023
1 parent 87c9e0d commit 31d5655
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pkg/detectors/openai/openai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestOpenAI_FromChunk(t *testing.T) {
want: []detectors.Result{
{
DetectorType: detectorspb.DetectorType_OpenAI,
Redacted: "sk-...xxxx",
Redacted: "sk-...gOPc",
Verified: false,
},
},
Expand All @@ -68,17 +68,7 @@ func TestOpenAI_FromChunk(t *testing.T) {
{
DetectorType: detectorspb.DetectorType_OpenAI,
Verified: true,
Redacted: "sk-...xxxx",
ExtraData: map[string]string{
"description": "",
"id": "",
"is_default": "",
"is_personal": "",
"role": "",
"title": "",
"total_orgs": "",
"user": "",
},
Redacted: "sk-...gOPb",
},
},
wantErr: false,
Expand Down Expand Up @@ -108,6 +98,7 @@ func TestOpenAI_FromChunk(t *testing.T) {
t.Fatal("no raw secret present")
}
got[i].Raw = nil
got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("OpenAI.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
Expand Down

0 comments on commit 31d5655

Please sign in to comment.