tusd/terminate_test.go

39 lines
572 B
Go
Raw Normal View History

2015-12-25 21:33:27 +00:00
package tusd_test
2015-02-28 13:47:39 +00:00
import (
"net/http"
"testing"
2015-12-25 21:33:27 +00:00
. "github.com/tus/tusd"
2015-02-28 13:47:39 +00:00
)
type terminateStore struct {
t *testing.T
zeroStore
}
func (s terminateStore) Terminate(id string) error {
if id != "foo" {
s.t.Fatal("unexpected id")
}
return nil
}
func TestTerminate(t *testing.T) {
handler, _ := NewHandler(Config{
DataStore: terminateStore{
t: t,
},
})
(&httpTest{
Name: "Successful request",
Method: "DELETE",
URL: "foo",
ReqHeader: map[string]string{
2015-03-23 17:15:05 +00:00
"Tus-Resumable": "1.0.0",
2015-02-28 13:47:39 +00:00
},
Code: http.StatusNoContent,
}).Run(handler, t)
}