Skip to content

Commit

Permalink
Merge branch 'master' into drop_commandcontext_newrestclient
Browse files Browse the repository at this point in the history
  • Loading branch information
xcoulon authored Mar 21, 2024
2 parents b50f06c + 6d9fe43 commit c8fd9d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import (
func TestNewClientOK(t *testing.T) {
// given
t.Cleanup(gock.OffAll)
gock.New("https://example.com").
gock.New("http://example.com").
Get("api").
Persist().
Reply(200).
BodyString("{}")

// when
cl, err := client.NewClient("cool-token", "https://example.com")
cl, err := client.NewClient("cool-token", "http://example.com")

// then
require.NoError(t, err)
Expand Down
8 changes: 0 additions & 8 deletions pkg/test/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ func NewFakeClients(t *testing.T, initObjs ...runtime.Object) (clicontext.NewCli
}

func NewFakeExternalClient(t *testing.T, token string, apiEndpoint string) *rest.RESTClient {
// mock request to download a script from GitHub
gock.New("https://raw.githubusercontent.com").
Get("codeready-toolchain/toolchain-cicd/master/scripts/add-cluster.sh").
Persist(). // make sure multiple requests are all handled by Gock
Reply(200)

// gock.Observe(gock.DumpRequest)
t.Cleanup(gock.OffAll)
cl, err := client.NewRESTClient(token, apiEndpoint)
require.NoError(t, err)
// override the underlying client's transport with Gock to intercep requests
Expand Down

0 comments on commit c8fd9d4

Please sign in to comment.