2015-02-28 13:47:39 +00:00
|
|
|
package tusd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|