Skip to content

Commit

Permalink
test: Fix test for new API client
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFaucherre committed Oct 17, 2023
1 parent 9a92adb commit c4121d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/pipelines/pipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,6 @@ func (f *fixture) Run(statusCode int, respBody string) (p *Pipelines, cleanup fu
return New(rest.NewFromConfig(server.URL, &settings.Config{
RestEndpoint: "api/v2",
Token: "fake-token",
HTTPClient: server.Client(),
})), server.Close
}
7 changes: 6 additions & 1 deletion cmd/pipeline/usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package pipeline

import (
"fmt"
"net/http"
"net/http/httptest"
"testing"

"github.com/spf13/cobra"
Expand All @@ -11,8 +13,11 @@ import (
)

func TestUsage(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
defer ts.Close()

preRunE := func(cmd *cobra.Command, args []string) error { return nil }
cmd := NewCommand(&settings.Config{}, preRunE)
cmd := NewCommand(&settings.Config{HTTPClient: ts.Client()}, preRunE)
testSubCommandUsage(t, cmd.Name(), cmd)
}

Expand Down

0 comments on commit c4121d4

Please sign in to comment.