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) {
|
2015-11-04 23:46:22 +00:00
|
|
|
handler, _ := NewRoutedHandler(Config{
|
2015-02-28 13:47:39 +00:00
|
|
|
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)
|
|
|
|
}
|