diff --git a/audit/audit_test.go b/audit/audit_test.go index 4a4c0162..13ba0158 100644 --- a/audit/audit_test.go +++ b/audit/audit_test.go @@ -29,136 +29,152 @@ func TestAudit(t *testing.T) { { description: "test local repo one aws leak", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_local_repo_one_aws_leak.json.got", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_local_repo_one_aws_leak.json.got", + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_one_aws_leak.json", }, { description: "test local repo one aws leak threaded", opts: options.Options{ - Threads: runtime.GOMAXPROCS(0), - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_local_repo_one_aws_leak.json.got", + Threads: runtime.GOMAXPROCS(0), + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_local_repo_one_aws_leak.json.got", + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_one_aws_leak.json", }, { description: "test non existent repo", opts: options.Options{ - RepoPath: "../test_data/test_repos/no_repo_here", + RepoPath: "../test_data/test_repos/no_repo_here", + ReportFormat: "json", }, emptyRepo: true, }, { description: "test local repo one aws leak whitelisted", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Config: "../test_data/test_configs/aws_key_whitelist_python_files.toml", + RepoPath: "../test_data/test_repos/test_repo_1", + ReportFormat: "json", + Config: "../test_data/test_configs/aws_key_whitelist_python_files.toml", }, wantEmpty: true, }, { description: "test local repo two leaks", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_2", - Report: "../test_data/test_local_repo_two_leaks.json.got", + RepoPath: "../test_data/test_repos/test_repo_2", + Report: "../test_data/test_local_repo_two_leaks.json.got", + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_two_leaks.json", }, { description: "test local repo two leaks globally whitelisted", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_2", - Config: "../test_data/test_configs/aws_key_global_whitelist_file.toml", + RepoPath: "../test_data/test_repos/test_repo_2", + Config: "../test_data/test_configs/aws_key_global_whitelist_file.toml", + ReportFormat: "json", }, wantEmpty: true, }, { description: "test local repo two leaks whitelisted", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_2", - Config: "../test_data/test_configs/aws_key_whitelist_files.toml", + RepoPath: "../test_data/test_repos/test_repo_2", + Config: "../test_data/test_configs/aws_key_whitelist_files.toml", + ReportFormat: "json", }, wantEmpty: true, }, { description: "test local repo three leaks dev branch", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_3", - Report: "../test_data/test_local_repo_three_leaks.json.got", - Config: "../test_data/test_configs/aws_key.toml", - Branch: "dev", + RepoPath: "../test_data/test_repos/test_repo_3", + Report: "../test_data/test_local_repo_three_leaks.json.got", + Config: "../test_data/test_configs/aws_key.toml", + Branch: "dev", + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_three_leaks.json", }, { description: "test local repo branch does not exist", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_3", - Branch: "nobranch", + RepoPath: "../test_data/test_repos/test_repo_3", + Branch: "nobranch", + ReportFormat: "json", }, wantEmpty: true, }, { description: "test local repo one aws leak single commit", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_local_repo_one_aws_leak_commit.json.got", - Commit: "6557c92612d3b35979bd426d429255b3bf9fab74", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_local_repo_one_aws_leak_commit.json.got", + Commit: "6557c92612d3b35979bd426d429255b3bf9fab74", + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_one_aws_leak_commit.json", }, { description: "test local repo one aws leak AND leak on python files", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got", - Config: "../test_data/test_configs/aws_key_file_regex.toml", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got", + 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", }, { description: "test owner path", opts: options.Options{ - OwnerPath: "../test_data/test_repos/", - Report: "../test_data/test_local_owner_aws_leak.json.got", + OwnerPath: "../test_data/test_repos/", + Report: "../test_data/test_local_owner_aws_leak.json.got", + ReportFormat: "json", }, wantPath: "../test_data/test_local_owner_aws_leak.json", }, { description: "test entropy", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_entropy.json.got", - Config: "../test_data/test_configs/entropy.toml", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_entropy.json.got", + Config: "../test_data/test_configs/entropy.toml", + ReportFormat: "json", }, wantPath: "../test_data/test_entropy.json", }, { description: "test entropy and regex", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_regex_entropy.json.got", - Config: "../test_data/test_configs/regex_entropy.toml", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_regex_entropy.json.got", + Config: "../test_data/test_configs/regex_entropy.toml", + ReportFormat: "json", }, wantPath: "../test_data/test_regex_entropy.json", }, { description: "test local repo four entropy alternative config", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_4", - Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got", - RepoConfig: true, + RepoPath: "../test_data/test_repos/test_repo_4", + Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got", + RepoConfig: true, + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json", }, { description: "test local repo four entropy alternative config", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_regex_whitelist.json.got", - Config: "../test_data/test_configs/aws_key_aws_whitelisted.toml", + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_regex_whitelist.json.got", + Config: "../test_data/test_configs/aws_key_aws_whitelisted.toml", + ReportFormat: "json", }, wantEmpty: true, }, @@ -222,9 +238,10 @@ func TestAuditUncommited(t *testing.T) { { description: "test audit local one leak", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Report: "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got", - Uncommited: true, + RepoPath: "../test_data/test_repos/test_repo_1", + Report: "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got", + Uncommited: true, + ReportFormat: "json", }, wantPath: "../test_data/test_local_repo_one_aws_leak_uncommitted.json", fileToChange: "server.test.py", @@ -233,8 +250,9 @@ func TestAuditUncommited(t *testing.T) { { description: "test audit local no leak", opts: options.Options{ - RepoPath: "../test_data/test_repos/test_repo_1", - Uncommited: true, + RepoPath: "../test_data/test_repos/test_repo_1", + Uncommited: true, + ReportFormat: "json", }, wantEmpty: true, fileToChange: "server.test.py",