Skip to content

Commit

Permalink
🌱 e2e for statuses (#3176)
Browse files Browse the repository at this point in the history
- e2e for statuses.

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan committed Jun 20, 2023
1 parent 18b70b2 commit 4c46028
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions clients/githubrepo/statuses_e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2023 OpenSSF Scorecard Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package githubrepo

import (
"context"
"net/http"

"github.com/google/go-github/v38/github"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/clients"
"github.com/ossf/scorecard/v4/clients/githubrepo/roundtripper"
"github.com/ossf/scorecard/v4/log"
)

var _ = Describe("E2E TEST: githubrepo.statusesHandler", func() {
var statusHandler *statusesHandler

BeforeEach(func() {
ctx := context.Background()
rt := roundtripper.NewTransport(context.Background(), &log.Logger{})
httpClient := &http.Client{
Transport: rt,
}
client := github.NewClient(httpClient)
statusHandler = &statusesHandler{
client: client,
ctx: ctx,
}
})
Context("listStatuses()", func() {
It("returns statuses", func() {
repoURL := repoURL{
owner: "ossf",
repo: "scorecard",
commitSHA: clients.HeadSHA,
}

statusHandler.init(context.Background(), &repoURL)
resp, err := statusHandler.listStatuses("8c9e552f68e5fd070692b8376ac51d2e8a7f0aaa")
Expect(err).NotTo(HaveOccurred())
Expect(len(resp)).ShouldNot(Equal(0))
})
})
})

0 comments on commit 4c46028

Please sign in to comment.