Skip to content

Commit 4f2eaea

Browse files
naveensrinivasanAndré Backman
authored andcommitted
🌱 Increase test coverage for searching commits (ossf#3276)
- Add an e2e test for searching commits by author - Search commits by author `dependabot[bot]` and expect results Signed-off-by: naveensrinivasan <[email protected]> Signed-off-by: André Backman <[email protected]>
1 parent bc290f0 commit 4f2eaea

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

e2e/searchCommits_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2023 OpenSSF Scorecard Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package e2e
16+
17+
import (
18+
"context"
19+
20+
. "github.com/onsi/ginkgo/v2"
21+
. "github.com/onsi/gomega"
22+
23+
"github.com/ossf/scorecard/v4/clients"
24+
"github.com/ossf/scorecard/v4/clients/githubrepo"
25+
)
26+
27+
var _ = Describe("E2E TEST:SearchCommits", func() {
28+
Context("E2E TEST:SearchCommits", func() {
29+
It("Should return commits by dependabot", func() {
30+
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
31+
Expect(err).Should(BeNil())
32+
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
33+
err = repoClient.InitRepo(repo, clients.HeadSHA, 0)
34+
Expect(err).Should(BeNil())
35+
commits, err := repoClient.SearchCommits(clients.SearchCommitsOptions{Author: "dependabot[bot]"})
36+
Expect(err).Should(BeNil())
37+
Expect(len(commits)).Should(BeNumerically(">", 0))
38+
})
39+
})
40+
})

0 commit comments

Comments
 (0)