Skip to content

Find, verify, and analyze leaked credentials

[Fix] detector's integration tests starting with alphabet 'b' (#3746)

Abdul Basit0ffa03c49c80
diff --git a/pkg/detectors/bitfinex/bitfinex_integration_test.go b/pkg/detectors/bitfinex/bitfinex_integration_test.go
index 479f9a964..b663cde92 100644
--- a/pkg/detectors/bitfinex/bitfinex_integration_test.go
+++ b/pkg/detectors/bitfinex/bitfinex_integration_test.go
@@ -53,6 +53,10 @@ func TestBitfinex_FromChunk(t *testing.T) {
DetectorType: detectorspb.DetectorType_Bitfinex,
Verified: true,
},
+ {
+ DetectorType: detectorspb.DetectorType_Bitfinex,
+ Verified: false,
+ },
},
wantErr: false,
},
@@ -69,6 +73,10 @@ func TestBitfinex_FromChunk(t *testing.T) {
DetectorType: detectorspb.DetectorType_Bitfinex,
Verified: false,
},
+ {
+ DetectorType: detectorspb.DetectorType_Bitfinex,
+ Verified: false,
+ },
},
wantErr: false,
},
diff --git a/pkg/detectors/bitmex/bitmex_integration_test.go b/pkg/detectors/bitmex/bitmex_integration_test.go
index 9aefeabd7..4272f4713 100644
--- a/pkg/detectors/bitmex/bitmex_integration_test.go
+++ b/pkg/detectors/bitmex/bitmex_integration_test.go
@@ -97,6 +97,10 @@ func TestBitmex_FromChunk(t *testing.T) {
t.Fatalf("no raw secret present: \n %+v", got[i])
}
got[i].Raw = nil
+ if len(got[i].RawV2) == 0 {
+ t.Fatalf("no raw v2 secret present: \n %+v", got[i])
+ }
+ got[i].RawV2 = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Bitmex.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
diff --git a/pkg/detectors/browserstack/browserstack_integration_test.go b/pkg/detectors/browserstack/browserstack_integration_test.go
index f8185173e..ebe47df31 100644
--- a/pkg/detectors/browserstack/browserstack_integration_test.go
+++ b/pkg/detectors/browserstack/browserstack_integration_test.go
@@ -116,7 +116,7 @@ func TestBrowserStack_FromChunk(t *testing.T) {
},
{
name: "found, verified but blocked by browserstack",
- s: Scanner{client: common.SaneHttpClient()},
+ s: Scanner{client: common.ConstantResponseHttpClient(403, "blocked")},
args: args{
ctx: context.Background(),
data: []byte(fmt.Sprintf("You can find a BROWSERSTACK_ACCESS_KEY %s within BROWSERSTACK_USERNAME %s", secret, secretUser)),
diff --git a/pkg/detectors/buildkite/v1/buildkite_integration_test.go b/pkg/detectors/buildkite/v1/buildkite_integration_test.go
index f0d334959..8ef4ad89d 100644
--- a/pkg/detectors/buildkite/v1/buildkite_integration_test.go
+++ b/pkg/detectors/buildkite/v1/buildkite_integration_test.go
@@ -95,6 +95,7 @@ func TestBuildkite_FromChunk(t *testing.T) {
t.Fatalf("no raw secret present: \n %+v", got[i])
}
got[i].Raw = nil
+ got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Buildkite.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
diff --git a/pkg/detectors/buildkite/v2/buildkitev2_integration_test.go b/pkg/detectors/buildkite/v2/buildkitev2_integration_test.go
index 26c8a2c1d..83c63391a 100644
--- a/pkg/detectors/buildkite/v2/buildkitev2_integration_test.go
+++ b/pkg/detectors/buildkite/v2/buildkitev2_integration_test.go
@@ -95,6 +95,7 @@ func TestBuildkite_FromChunk(t *testing.T) {
t.Fatalf("no raw secret present: \n %+v", got[i])
}
got[i].Raw = nil
+ got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Buildkite.FromData() %s diff: (-got +want)\n%s", tt.name, diff)