Skip to content

Commit

Permalink
fix (#1837)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon authored Apr 13, 2022
1 parent b00b316 commit 410a145
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions clients/githubrepo/branches_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ var _ = Describe("E2E TEST: githubrepo.branchesHandler", func() {
})

Context("E2E TEST: Validate query cost", func() {
skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only")

It("Should not have increased for HEAD query", func() {
skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only")

repourl := &repoURL{
owner: "ossf",
repo: "scorecard",
Expand All @@ -48,6 +48,8 @@ var _ = Describe("E2E TEST: githubrepo.branchesHandler", func() {
Expect(*brancheshandler.data.RateLimit.Cost).Should(BeNumerically("<=", 1))
})
It("Should fail for non-HEAD query", func() {
skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only")

repourl := &repoURL{
owner: "ossf",
repo: "scorecard",
Expand Down
11 changes: 7 additions & 4 deletions e2e/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (

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

It("Should get non-admin branch protection on other repositories", func() {
skipIfTokenIsNot(patTokenType, "PAT only")

dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e")
Expect(err).Should(BeNil())
Expand Down Expand Up @@ -62,6 +62,8 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
Expect(repoClient.Close()).Should(BeNil())
})
It("Should fail to return branch protection on other repositories", func() {
skipIfTokenIsNot(patTokenType, "PAT only")

dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-none")
Expect(err).Should(BeNil())
Expand Down Expand Up @@ -92,6 +94,8 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() {
Expect(repoClient.Close()).Should(BeNil())
})
It("Should fail to return branch protection on other repositories", func() {
skipIfTokenIsNot(patTokenType, "PAT only")

dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-patch-1")
Expect(err).Should(BeNil())
Expand Down Expand Up @@ -126,9 +130,8 @@ 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() {
skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only")
dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e")
Expect(err).Should(BeNil())
Expand Down

0 comments on commit 410a145

Please sign in to comment.