add delete command
This commit is contained in:
parent
293a9e0aba
commit
1a101faaae
4 changed files with 76 additions and 0 deletions
41
cmd/mstdn/cmd_delete_test.go
Normal file
41
cmd/mstdn/cmd_delete_test.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func TestCmdDelete(t *testing.T) {
|
||||
ok := false
|
||||
f := func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/api/v1/statuses/123":
|
||||
fmt.Fprintln(w, `{}`)
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
testWithServer(
|
||||
f, func(app *cli.App) {
|
||||
app.Run([]string{"mstdn", "delete", "122"})
|
||||
},
|
||||
)
|
||||
if ok {
|
||||
t.Fatal("something wrong to sequence to follow account")
|
||||
}
|
||||
|
||||
ok = false
|
||||
testWithServer(
|
||||
f, func(app *cli.App) {
|
||||
app.Run([]string{"mstdn", "delete", "123"})
|
||||
},
|
||||
)
|
||||
if !ok {
|
||||
t.Fatal("something wrong to sequence to follow account")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue