Add test for upload to final upload
This commit is contained in:
parent
888049ce50
commit
24e68df7cd
|
@ -2,6 +2,7 @@ package tusd_test
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
|
@ -204,5 +205,29 @@ func TestConcat(t *testing.T) {
|
|||
Code: http.StatusRequestEntityTooLarge,
|
||||
}).Run(handler, t)
|
||||
})
|
||||
|
||||
SubTest(t, "UploadToFinalFail", func(t *testing.T, store *MockFullDataStore) {
|
||||
store.EXPECT().GetInfo("foo").Return(FileInfo{
|
||||
Size: 10,
|
||||
Offset: 0,
|
||||
IsFinal: true,
|
||||
}, nil)
|
||||
|
||||
handler, _ := NewHandler(Config{
|
||||
DataStore: store,
|
||||
})
|
||||
|
||||
(&httpTest{
|
||||
Method: "PATCH",
|
||||
URL: "foo",
|
||||
ReqHeader: map[string]string{
|
||||
"Tus-Resumable": "1.0.0",
|
||||
"Content-Type": "application/offset+octet-stream",
|
||||
"Upload-Offset": "5",
|
||||
},
|
||||
ReqBody: strings.NewReader("hello"),
|
||||
Code: http.StatusForbidden,
|
||||
}).Run(handler, t)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue