Add test for upload to final upload

This commit is contained in:
Marius 2016-10-13 18:42:40 +02:00
parent 888049ce50
commit 24e68df7cd
1 changed files with 25 additions and 0 deletions

View File

@ -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)
})
})
}