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 19ce1e9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions api/pipelines/pipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestPipelines_Trigger(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "POST"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"Content-Length": {"24"},
"Content-Type": {"application/json"},
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestPipelines_Get(t *testing.T) {
assert.Check(t, cmp.Equal(fix.method, "GET"))
assert.Check(t, cmp.DeepEqual(fix.Header(), http.Header{
"Accept-Encoding": {"gzip"},
"Accept-Type": {"application/json"},
"Accept": {"application/json"},
"Circle-Token": {"fake-token"},
"User-Agent": {version.UserAgent()},
}))
Expand Down 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
}
Empty file added cmd/.circleci/cli.yml
Empty file.
4 changes: 4 additions & 0 deletions cmd/.circleci/telemetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
is_enabled: false
has_answered_prompt: true
unique_id: ea33f5f1-a272-46e2-a596-db1e536ad4e9
user_id: ""
1 change: 1 addition & 0 deletions cmd/.circleci/update_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last_update_check: 2023-10-17T14:50:25.397713+02:00
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 19ce1e9

Please sign in to comment.