X Tutup
Skip to content

Commit eb08774

Browse files
committed
Assert that executeTemplate is invoked
1 parent f53ad71 commit eb08774

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/cmd/api/api_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,20 @@ func Test_apiRun(t *testing.T) {
426426
stdout: "HTTP/1.1 200 Okey-dokey\nContent-Type: text/plain\r\n\r\n",
427427
stderr: ``,
428428
},
429+
{
430+
name: "output template",
431+
options: ApiOptions{
432+
Template: `{{.status}}`,
433+
},
434+
httpResponse: &http.Response{
435+
StatusCode: 200,
436+
Body: ioutil.NopCloser(bytes.NewBufferString(`{"status":"not a cat"}`)),
437+
Header: http.Header{"Content-Type": []string{"application/json"}},
438+
},
439+
err: nil,
440+
stdout: "not a cat",
441+
stderr: ``,
442+
},
429443
}
430444

431445
for _, tt := range tests {

0 commit comments

Comments
 (0)
X Tutup