37 lines
541 B
Go
37 lines
541 B
Go
|
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{
|
||
|
"TUS-Resumable": "1.0.0",
|
||
|
},
|
||
|
Code: http.StatusNoContent,
|
||
|
}).Run(handler, t)
|
||
|
}
|