Skip to content

Commit

Permalink
Fix bug in GitHub unit test mocking (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcastorina committed Jun 6, 2022
1 parent 56c8717 commit 9074006
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/sources/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (s *Source) enumerateWithApp(ctx context.Context, apiEndpoint string, app *

// This client is used for most APIs
itr, err := ghinstallation.New(
common.SaneHttpClient().Transport,
s.httpClient.Transport,
appID,
installationID,
[]byte(app.PrivateKey))
Expand All @@ -258,7 +258,7 @@ func (s *Source) enumerateWithApp(ctx context.Context, apiEndpoint string, app *
// This client is required to create installation tokens for cloning.. Otherwise the required JWT is not in the
// request for the token :/
appItr, err := ghinstallation.NewAppsTransport(
common.SaneHttpClient().Transport,
s.httpClient.Transport,
appID,
[]byte(app.PrivateKey))
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/sources/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io"
"net/http"
"reflect"
Expand Down Expand Up @@ -40,6 +39,7 @@ func initTestSource(src *sourcespb.GitHub) *Source {
if err := s.Init(context.TODO(), "test - github", 0, 1337, false, conn, 1); err != nil {
panic(err)
}
gock.InterceptClient(s.httpClient)
return s
}

Expand Down Expand Up @@ -334,7 +334,6 @@ func TestEnumerateWithApp(t *testing.T) {
PrivateKey: privateKey,
},
)
fmt.Println(err)
assert.Nil(t, err)
assert.Equal(t, 0, len(s.repos))

Expand Down

0 comments on commit 9074006

Please sign in to comment.