Просмотр исходного кода

added tests for scanning single branch and non-existing branch

Adam Kobi 7 лет назад
Родитель
Сommit
6b3bd46fa8
1 измененных файлов с 17 добавлено и 0 удалено
  1. 17 0
      gitleaks_test.go

+ 17 - 0
gitleaks_test.go

@@ -320,6 +320,23 @@ func TestRun(t *testing.T) {
 			expectedErrMsg: "",
 			commitPerPage:  1,
 		},
+		{
+			testOpts: Options{
+				Repo:   "https://github.com/gitleakstest/gronit.git",
+				Branch: "master",
+			},
+			description: "test github leaks on single branch - master",
+			numLeaks:    2,
+		},
+		{
+			testOpts: Options{
+				Repo:   "https://github.com/gitleakstest/gronit.git",
+				Branch: "nonExistingBranch",
+			},
+			description:    "test github leaks on single branch which doesn't exist",
+			numLeaks:       0,
+			expectedErrMsg: "reference not found",
+		},
 	}
 	g := goblin.Goblin(t)
 	for _, test := range tests {