mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
adding report-format to tests since we dont parse flags
This commit is contained in:
1 parent
3211cfbbb1
commit
f3eac0c958
1 file changed
+18
@@ -31,6 +31,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
|
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
|
||||||
},
|
},
|
||||||
@@ -40,6 +41,7 @@ func TestAudit(t *testing.T) {
|
|||||||
Threads: runtime.GOMAXPROCS(0),
|
Threads: runtime.GOMAXPROCS(0),
|
||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
|
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
|
||||||
},
|
},
|
||||||
@@ -47,6 +49,7 @@ func TestAudit(t *testing.T) {
|
|||||||
description: "test non existent repo",
|
description: "test non existent repo",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/no_repo_here",
|
RepoPath: "../test_data/test_repos/no_repo_here",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
emptyRepo: true,
|
emptyRepo: true,
|
||||||
},
|
},
|
||||||
@@ -54,6 +57,7 @@ func TestAudit(t *testing.T) {
|
|||||||
description: "test local repo one aws leak whitelisted",
|
description: "test local repo one aws leak whitelisted",
|
||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
|
ReportFormat: "json",
|
||||||
Config: "../test_data/test_configs/aws_key_whitelist_python_files.toml",
|
Config: "../test_data/test_configs/aws_key_whitelist_python_files.toml",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
@@ -63,6 +67,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_2",
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
Report: "../test_data/test_local_repo_two_leaks.json.got",
|
Report: "../test_data/test_local_repo_two_leaks.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_two_leaks.json",
|
wantPath: "../test_data/test_local_repo_two_leaks.json",
|
||||||
},
|
},
|
||||||
@@ -71,6 +76,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_2",
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
Config: "../test_data/test_configs/aws_key_global_whitelist_file.toml",
|
Config: "../test_data/test_configs/aws_key_global_whitelist_file.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
},
|
},
|
||||||
@@ -79,6 +85,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_2",
|
RepoPath: "../test_data/test_repos/test_repo_2",
|
||||||
Config: "../test_data/test_configs/aws_key_whitelist_files.toml",
|
Config: "../test_data/test_configs/aws_key_whitelist_files.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
},
|
},
|
||||||
@@ -89,6 +96,7 @@ func TestAudit(t *testing.T) {
|
|||||||
Report: "../test_data/test_local_repo_three_leaks.json.got",
|
Report: "../test_data/test_local_repo_three_leaks.json.got",
|
||||||
Config: "../test_data/test_configs/aws_key.toml",
|
Config: "../test_data/test_configs/aws_key.toml",
|
||||||
Branch: "dev",
|
Branch: "dev",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_three_leaks.json",
|
wantPath: "../test_data/test_local_repo_three_leaks.json",
|
||||||
},
|
},
|
||||||
@@ -97,6 +105,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_3",
|
RepoPath: "../test_data/test_repos/test_repo_3",
|
||||||
Branch: "nobranch",
|
Branch: "nobranch",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
},
|
},
|
||||||
@@ -106,6 +115,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_local_repo_one_aws_leak_commit.json.got",
|
Report: "../test_data/test_local_repo_one_aws_leak_commit.json.got",
|
||||||
Commit: "6557c92612d3b35979bd426d429255b3bf9fab74",
|
Commit: "6557c92612d3b35979bd426d429255b3bf9fab74",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_one_aws_leak_commit.json",
|
wantPath: "../test_data/test_local_repo_one_aws_leak_commit.json",
|
||||||
},
|
},
|
||||||
@@ -115,6 +125,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got",
|
Report: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got",
|
||||||
Config: "../test_data/test_configs/aws_key_file_regex.toml",
|
Config: "../test_data/test_configs/aws_key_file_regex.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json",
|
wantPath: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json",
|
||||||
},
|
},
|
||||||
@@ -123,6 +134,7 @@ func TestAudit(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
OwnerPath: "../test_data/test_repos/",
|
OwnerPath: "../test_data/test_repos/",
|
||||||
Report: "../test_data/test_local_owner_aws_leak.json.got",
|
Report: "../test_data/test_local_owner_aws_leak.json.got",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_owner_aws_leak.json",
|
wantPath: "../test_data/test_local_owner_aws_leak.json",
|
||||||
},
|
},
|
||||||
@@ -132,6 +144,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_entropy.json.got",
|
Report: "../test_data/test_entropy.json.got",
|
||||||
Config: "../test_data/test_configs/entropy.toml",
|
Config: "../test_data/test_configs/entropy.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_entropy.json",
|
wantPath: "../test_data/test_entropy.json",
|
||||||
},
|
},
|
||||||
@@ -141,6 +154,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_regex_entropy.json.got",
|
Report: "../test_data/test_regex_entropy.json.got",
|
||||||
Config: "../test_data/test_configs/regex_entropy.toml",
|
Config: "../test_data/test_configs/regex_entropy.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_regex_entropy.json",
|
wantPath: "../test_data/test_regex_entropy.json",
|
||||||
},
|
},
|
||||||
@@ -150,6 +164,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_4",
|
RepoPath: "../test_data/test_repos/test_repo_4",
|
||||||
Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got",
|
Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got",
|
||||||
RepoConfig: true,
|
RepoConfig: true,
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json",
|
wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json",
|
||||||
},
|
},
|
||||||
@@ -159,6 +174,7 @@ func TestAudit(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_regex_whitelist.json.got",
|
Report: "../test_data/test_regex_whitelist.json.got",
|
||||||
Config: "../test_data/test_configs/aws_key_aws_whitelisted.toml",
|
Config: "../test_data/test_configs/aws_key_aws_whitelisted.toml",
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
},
|
},
|
||||||
@@ -225,6 +241,7 @@ func TestAuditUncommited(t *testing.T) {
|
|||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Report: "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got",
|
Report: "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got",
|
||||||
Uncommited: true,
|
Uncommited: true,
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantPath: "../test_data/test_local_repo_one_aws_leak_uncommitted.json",
|
wantPath: "../test_data/test_local_repo_one_aws_leak_uncommitted.json",
|
||||||
fileToChange: "server.test.py",
|
fileToChange: "server.test.py",
|
||||||
@@ -235,6 +252,7 @@ func TestAuditUncommited(t *testing.T) {
|
|||||||
opts: options.Options{
|
opts: options.Options{
|
||||||
RepoPath: "../test_data/test_repos/test_repo_1",
|
RepoPath: "../test_data/test_repos/test_repo_1",
|
||||||
Uncommited: true,
|
Uncommited: true,
|
||||||
|
ReportFormat: "json",
|
||||||
},
|
},
|
||||||
wantEmpty: true,
|
wantEmpty: true,
|
||||||
fileToChange: "server.test.py",
|
fileToChange: "server.test.py",
|
||||||
|
|||||||
Reference in new issue
Block a user