Add POST tests
This commit is contained in:
parent
5252c98cd7
commit
acaaa10ff7
48
post_test.go
48
post_test.go
|
@ -123,6 +123,54 @@ func TestPost(t *testing.T) {
|
|||
}).Run(handler, t)
|
||||
})
|
||||
|
||||
SubTest(t, "UploadLengthAndUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) {
|
||||
handler, _ := NewHandler(Config{
|
||||
DataStore: store,
|
||||
})
|
||||
|
||||
(&httpTest{
|
||||
Method: "POST",
|
||||
URL: "",
|
||||
ReqHeader: map[string]string{
|
||||
"Tus-Resumable": "1.0.0",
|
||||
"Upload-Length": "10",
|
||||
"Upload-Defer-Length": "1",
|
||||
},
|
||||
Code: http.StatusBadRequest,
|
||||
}).Run(handler, t)
|
||||
})
|
||||
|
||||
SubTest(t, "NeitherUploadLengthNorUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) {
|
||||
handler, _ := NewHandler(Config{
|
||||
DataStore: store,
|
||||
})
|
||||
|
||||
(&httpTest{
|
||||
Method: "POST",
|
||||
URL: "",
|
||||
ReqHeader: map[string]string{
|
||||
"Tus-Resumable": "1.0.0",
|
||||
},
|
||||
Code: http.StatusBadRequest,
|
||||
}).Run(handler, t)
|
||||
})
|
||||
|
||||
SubTest(t, "InvalidUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) {
|
||||
handler, _ := NewHandler(Config{
|
||||
DataStore: store,
|
||||
})
|
||||
|
||||
(&httpTest{
|
||||
Method: "POST",
|
||||
URL: "",
|
||||
ReqHeader: map[string]string{
|
||||
"Tus-Resumable": "1.0.0",
|
||||
"Upload-Defer-Length": "bad",
|
||||
},
|
||||
Code: http.StatusBadRequest,
|
||||
}).Run(handler, t)
|
||||
})
|
||||
|
||||
SubTest(t, "ForwardHeaders", func(t *testing.T, store *MockFullDataStore) {
|
||||
SubTest(t, "IgnoreXForwarded", func(t *testing.T, store *MockFullDataStore) {
|
||||
store.EXPECT().NewUpload(FileInfo{
|
||||
|
|
Loading…
Reference in New Issue