-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_test.go
45 lines (38 loc) · 910 Bytes
/
options_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package tusd_test
import (
"net/http"
"testing"
. "github.com/tus/tusd"
)
func TestOptions(t *testing.T) {
SubTest(t, "Discovery", func(t *testing.T, store *MockFullDataStore) {
composer := NewStoreComposer()
composer.UseCore(store)
handler, _ := NewHandler(Config{
StoreComposer: composer,
MaxSize: 400,
})
(&httpTest{
Method: "OPTIONS",
ResHeader: map[string]string{
"Tus-Extension": "creation,creation-with-upload",
"Tus-Version": "1.0.0",
"Tus-Resumable": "1.0.0",
"Tus-Max-Size": "400",
},
Code: http.StatusOK,
}).Run(handler, t)
})
SubTest(t, "InvalidVersion", func(t *testing.T, store *MockFullDataStore) {
handler, _ := NewHandler(Config{
DataStore: store,
})
(&httpTest{
Method: "POST",
ReqHeader: map[string]string{
"Tus-Resumable": "foo",
},
Code: http.StatusPreconditionFailed,
}).Run(handler, t)
})
}