add test for -ff

pull/44/head
Yasuhiro Matsumoto 2017-04-24 19:47:07 +09:00
parent e29b2993a6
commit 041bfc1dcd
1 changed files with 21 additions and 0 deletions

View File

@ -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")
}
}