From 041bfc1dcddda758a91cc695361ce6b7f7beac69 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 24 Apr 2017 19:47:07 +0900 Subject: [PATCH] add test for -ff --- cmd/mstdn/cmd_toot_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmd/mstdn/cmd_toot_test.go b/cmd/mstdn/cmd_toot_test.go index 0122721..4f997f0 100644 --- a/cmd/mstdn/cmd_toot_test.go +++ b/cmd/mstdn/cmd_toot_test.go @@ -29,3 +29,24 @@ func TestCmdToot(t *testing.T) { t.Fatalf("want %q, got %q", "foo", toot) } } + +func TestCmdTootFileNotFound(t *testing.T) { + var err error + testWithServer( + func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/api/v1/statuses": + fmt.Fprintln(w, `{"id": 2345}`) + return + } + http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) + return + }, + func(app *cli.App) { + err = app.Run([]string{"mstdn", "toot", "-ff", "not-found"}) + }, + ) + if err == nil { + t.Fatal("should be fail") + } +}