Skip to content

Commit a282b47

Browse files
committed
Add e2e coverage for new SDK-backed commands
1 parent b01643f commit a282b47

6 files changed

Lines changed: 101 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ sudo rpm -i fizzy-cli_VERSION_linux_amd64.rpm
8686

8787
```bash
8888
fizzy board list # List boards
89+
fizzy board accesses --board ID # Show board access settings and users
90+
fizzy activity list --board ID # List recent board activity
8991
fizzy card list # List cards on default board
9092
fizzy card show 42 # Show card details
9193
fizzy card create --board ID --title "Fix login bug" # Create card
9294
fizzy card close 42 # Close card
9395
fizzy search "authentication" # Search across cards
9496
fizzy comment create --card 42 --body "Looks good!" # Add comment
97+
fizzy webhook deliveries --board ID WEBHOOK_ID # List webhook deliveries
98+
fizzy user export-create USER_ID # Create a user data export
9599
```
96100

97101
### Attachments

e2e/cli_tests/account_user_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,27 @@ func TestUserAvatarUpdateAndRemove(t *testing.T) {
122122
t.Fatal("expected avatar endpoint to fall back to generated SVG after removal")
123123
}
124124
}
125+
126+
func TestUserExportCreateShow(t *testing.T) {
127+
h := newHarness(t)
128+
userID := currentUserID(t, h)
129+
130+
create := h.Run("user", "export-create", userID)
131+
assertOK(t, create)
132+
exportID := create.GetDataString("id")
133+
if exportID == "" {
134+
exportID = mapValueString(create.GetDataMap(), "id")
135+
}
136+
if exportID == "" {
137+
t.Fatal("expected export ID in user export-create response")
138+
}
139+
140+
show := h.Run("user", "export-show", userID, exportID)
141+
assertOK(t, show)
142+
if got := mapValueString(show.GetDataMap(), "id"); got != exportID {
143+
t.Fatalf("expected export-show id %q, got %q", exportID, got)
144+
}
145+
if got := mapValueString(show.GetDataMap(), "status"); got == "" {
146+
t.Fatal("expected export status in user export-show response")
147+
}
148+
}

e2e/cli_tests/crud_board_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ func TestBoardViews(t *testing.T) {
134134
}
135135
}
136136

137+
func TestBoardAccesses(t *testing.T) {
138+
h := newHarness(t)
139+
boardID := createBoard(t, h)
140+
141+
result := h.Run("board", "accesses", "--board", boardID)
142+
assertOK(t, result)
143+
if got := result.GetDataString("board_id"); got != boardID {
144+
t.Fatalf("expected board_id %q, got %q", boardID, got)
145+
}
146+
if _, ok := result.GetDataMap()["all_access"]; !ok {
147+
t.Fatal("expected all_access in board accesses response")
148+
}
149+
if _, ok := result.GetDataMap()["users"]; !ok {
150+
t.Fatal("expected users in board accesses response")
151+
}
152+
}
153+
137154
func TestBoardInvolvement(t *testing.T) {
138155
h := newHarness(t)
139156
boardID := createBoard(t, h)

e2e/cli_tests/output_contract_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ func TestOutputContractShowCommands(t *testing.T) {
217217
args []string
218218
}{
219219
{"board-show", []string{"board", "show", fixture.BoardID}},
220+
{"board-accesses", []string{"board", "accesses", "--board", fixture.BoardID}},
220221
{"card-show", []string{"card", "show", cardNum}},
221222
{"column-show", []string{"column", "show", fixture.ColumnID, "--board", fixture.BoardID}},
222223
{"comment-show", []string{"comment", "show", fixture.CommentID, "--card", cardNum}},

e2e/cli_tests/syntax_contract_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
func TestBoardBoardScopedCommandsUseBoardFlag(t *testing.T) {
1111
h := newHarness(t)
1212
for name, args := range map[string][]string{
13+
"accesses": {"board", "accesses", "--board", fixture.BoardID},
1314
"closed": {"board", "closed", "--board", fixture.BoardID},
1415
"postponed": {"board", "postponed", "--board", fixture.BoardID},
1516
"stream": {"board", "stream", "--board", fixture.BoardID},

e2e/cli_tests/webhook_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,57 @@ func TestWebhookCRUD(t *testing.T) {
7777
}
7878
assertResult(t, h.Run("webhook", "show", "--board", boardID, webhookID), harness.ExitNotFound)
7979
}
80+
81+
func TestWebhookDeliveries(t *testing.T) {
82+
h := newHarness(t)
83+
boardID := createBoard(t, h)
84+
cardNum := createCard(t, h, boardID)
85+
name := "CLI Delivery Hook " + strconv.FormatInt(time.Now().UnixNano(), 10)
86+
87+
create := h.Run("webhook", "create",
88+
"--board", boardID,
89+
"--name", name,
90+
"--url", "https://example.com/fizzy-cli-webhook-deliveries",
91+
"--actions", "card_closed",
92+
)
93+
assertOK(t, create)
94+
webhookID := create.GetIDFromLocation()
95+
if webhookID == "" {
96+
webhookID = create.GetDataString("id")
97+
}
98+
if webhookID == "" {
99+
t.Fatal("no webhook ID in create response")
100+
}
101+
t.Cleanup(func() {
102+
newHarness(t).Run("webhook", "delete", "--board", boardID, webhookID)
103+
})
104+
105+
assertOK(t, h.Run("card", "close", strconv.Itoa(cardNum)))
106+
107+
var deliveries *harness.Result
108+
for attempt := 0; attempt < 15; attempt++ {
109+
r := h.Run("webhook", "deliveries", "--board", boardID, webhookID)
110+
if r.ExitCode == harness.ExitSuccess && len(r.GetDataArray()) > 0 {
111+
deliveries = r
112+
break
113+
}
114+
time.Sleep(200 * time.Millisecond)
115+
}
116+
if deliveries == nil {
117+
t.Fatal("expected at least one webhook delivery after triggering card_closed")
118+
}
119+
120+
assertOK(t, deliveries)
121+
if len(deliveries.GetDataArray()) == 0 {
122+
t.Fatal("expected webhook deliveries to be non-empty")
123+
}
124+
first := asMap(deliveries.GetDataArray()[0])
125+
if mapValueString(first, "id") == "" {
126+
t.Fatal("expected delivery id")
127+
}
128+
if mapValueString(first, "state") == "" {
129+
t.Fatal("expected delivery state")
130+
}
131+
132+
assertOK(t, h.Run("webhook", "deliveries", "--board", boardID, webhookID, "--all"))
133+
}

0 commit comments

Comments
 (0)