Skip to content

Commit

Permalink
Fix query string passed to gh search call, extend integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosk committed Nov 17, 2021
1 parent cf10874 commit fb558c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 1 addition & 4 deletions github/githubclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package github
import (
"context"
"fmt"
"net/url"

"github.com/fluxcd/go-git-providers/gitprovider"
"github.com/google/go-github/v35/github"
Expand Down Expand Up @@ -238,9 +237,7 @@ func validateRepositoryObjects(apiObjs []*github.Repository) ([]*github.Reposito
func (c *githubClientImpl) ListUserRepos(ctx context.Context, username string) ([]*github.Repository, error) {
var apiObjs []*github.Repository
opts := &github.SearchOptions{}
params := url.Values{}
params.Add("user", username)
queryStr := params.Encode()
queryStr := fmt.Sprintf("user:%s", username)

err := allPages(&opts.ListOptions, func() (*github.Response, error) {
// GET /search?q=user:{username}
Expand Down
8 changes: 8 additions & 0 deletions github/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ var _ = Describe("GitHub Provider", func() {
getSpec := newGithubRepositorySpec(getUserRepo.APIObject().(*github.Repository))
postSpec := newGithubRepositorySpec(userRepo.APIObject().(*github.Repository))
Expect(getSpec.Equals(postSpec)).To(BeTrue())

Eventually(func() gitprovider.UserRepository {
// Expect that listing repositories from an authenticated user includes the new private repo
newRepos, err := c.UserRepositories().List(ctx, newUserRef(testUser))
Expect(err).ToNot(HaveOccurred())
newRepo := findUserRepo(newRepos, testUserRepoName)
return newRepo
}, 3*time.Second, 1*time.Second).ShouldNot(BeNil())
})

It("should error at creation time if the repo already does exist", func() {
Expand Down

0 comments on commit fb558c8

Please sign in to comment.