Skip to content

Find, verify, and analyze leaked credentials

[Fix] detector's integration tests starting with alphabet 'm' (#3807)

Abdul Basite2af279c3dec
diff --git a/pkg/detectors/mailchimp/mailchimp_integration_test.go b/pkg/detectors/mailchimp/mailchimp_integration_test.go
index c181fd567..d524439ef 100644
--- a/pkg/detectors/mailchimp/mailchimp_integration_test.go
+++ b/pkg/detectors/mailchimp/mailchimp_integration_test.go
@@ -94,6 +94,7 @@ func TestMailchimp_FromChunk(t *testing.T) {
}
got[i].Raw = nil
got[i].AnalysisInfo = nil
+ got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mailchimp.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
diff --git a/pkg/detectors/mailgun/mailgun_integration_test.go b/pkg/detectors/mailgun/mailgun_integration_test.go
index 0b887ce2c..65f7934ec 100644
--- a/pkg/detectors/mailgun/mailgun_integration_test.go
+++ b/pkg/detectors/mailgun/mailgun_integration_test.go
@@ -130,6 +130,7 @@ func TestMailgun_FromChunk(t *testing.T) {
}
got[i].Raw = nil
got[i].AnalysisInfo = nil
+ got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mailgun.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
diff --git a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken_integration_test.go b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken_integration_test.go
index b1db37b78..26b960561 100644
--- a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken_integration_test.go
+++ b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken_integration_test.go
@@ -60,7 +60,7 @@ func TestMattermostPersonalToken_FromChunk(t *testing.T) {
s: Scanner{},
args: args{
ctx: context.Background(),
- data: []byte(fmt.Sprintf("You can find a mattermost secret %s within mattermost server %s but not valid", inactiveSecret, "test323561.cloud.mattermost.com")), // the secret would satisfy the regex but not pass validation
+ data: []byte(fmt.Sprintf("You can find a mattermost secret %s within mattermost server %s but not valid", inactiveSecret, server)), // the secret would satisfy the regex but not pass validation
verify: true,
},
want: []detectors.Result{
@@ -96,6 +96,11 @@ func TestMattermostPersonalToken_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 RawV2 secret present: \n %+v", got[i])
+ }
+ got[i].RawV2 = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("MattermostPersonalToken.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
diff --git a/pkg/detectors/mux/mux_integration_test.go b/pkg/detectors/mux/mux_integration_test.go
index 871b44a7a..ec8427b86 100644
--- a/pkg/detectors/mux/mux_integration_test.go
+++ b/pkg/detectors/mux/mux_integration_test.go
@@ -97,6 +97,11 @@ func TestMux_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 rawv2 secret present: \n %+v", got[i])
+ }
+ got[i].RawV2 = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mux.FromData() %s diff: (-got +want)\n%s", tt.name, diff)