Skip to content

Commit

Permalink
馃尡 E2e Gitlab Issues (#3343)
Browse files Browse the repository at this point in the history
* 馃尡 Add E2E tests for Gitlab repo issues

- Add an E2E test for Gitlab repo issues
- Add two tests: one for a repo with issues, one for a repo without issues

[clients/gitlabrepo/issues_e2e_test.go]
- Add an E2E test for Gitlab repo issues
- Add two tests: one for a repo with issues, one for a repo without issues

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>

* Improve issue e2e tests & error handling

- Remove copyright notice and associated code from `clients/gitlabrepo/issues_e2e_test.go`
- Change `ListIssues` to return an error if `ListAllProjectMembers` is not available

[clients/gitlabrepo/issues_e2e_test.go]
- Remove copyright notice and associated code from `clients/gitlabrepo/issues_e2e_test.go`
- Change `ListIssues` to return an error if `ListAllProjectMembers` is not available

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>

* Improve GitLab issues error handling

- Update context of test from "Test list issues - GitLab" to "Test list issues errors - GitLab"
- Change test to return errors when listing for issues with normal token

[clients/gitlabrepo/issues_e2e_test.go]
- Change context of test from "Test list issues - GitLab" to "Test list issues errors - GitLab"
- Change test from "returns branches for the repo" to "returns errors when listing for issues with normal token"

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>

---------

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan committed Aug 4, 2023
1 parent a8b255a commit 76dc144
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions clients/gitlabrepo/issues_e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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 gitlabrepo

import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("E2E TEST: gitlabrepo.ListIssues", func() {
Context("Test list issues errors - GitLab", func() {
It("returns errors when listing for issues with normal token", func() {
repo, err := MakeGitlabRepo("https://gitlab.com/ossf-test/e2e-issues")
Expect(err).Should(BeNil())

client, err := CreateGitlabClient(context.Background(), repo.Host())
Expect(err).Should(BeNil())

err = client.InitRepo(repo, "HEAD", 0)
Expect(err).Should(BeNil())
_, err = client.ListIssues()
// returns error as the code checks for ListAllProjectMembers which is not available
// TODO: this will be fixed when it is fixed in the code
Expect(err).ShouldNot(BeNil())
})
})
})

0 comments on commit 76dc144

Please sign in to comment.