Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon authored and naveensrinivasan committed Apr 12, 2022
1 parent 2873c0d commit 4b2c677
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion e2e/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
Context("E2E TEST:Validating branch protection", func() {
skipIfTokenIs(githubWorkflowDefaultTokenType, checks.CheckBranchProtection+" does not support GITHUB_TOKEN")
skipIfTokenIsNot(patTokenType, "PAT only")

It("Should get non-admin branch protection on other repositories", func() {
dl := scut.TestDetailLogger{}
Expand Down Expand Up @@ -123,3 +123,28 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
})
})
})

var _ = Describe("E2E TEST GITHUB_TOKEN:"+checks.CheckBranchProtection, func() {
Context("E2E TEST:Validating branch protection", func() {
skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only")

It("Should get errors with GITHUB_TOKEN", func() {
dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e")
Expect(err).Should(BeNil())
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
err = repoClient.InitRepo(repo, clients.HeadSHA)
Expect(err).Should(BeNil())
req := checker.CheckRequest{
Ctx: context.Background(),
RepoClient: repoClient,
Repo: repo,
Dlogger: &dl,
}

result := checks.BranchProtection(&req)
Expect(result.Error).ShouldNot(BeNil())
Expect(repoClient.Close()).Should(BeNil())
})
})
})

0 comments on commit 4b2c677

Please sign in to comment.