forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader-session_test.go
53 lines (49 loc) · 915 Bytes
/
header-session_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
46
47
48
49
50
51
52
53
package gortsplib
import (
"testing"
"github.com/stretchr/testify/require"
)
var casesHeaderSession = []struct {
name string
value HeaderValue
hs *HeaderSession
}{
{
"base",
HeaderValue{`A3eqwsafq3rFASqew`},
&HeaderSession{
Session: "A3eqwsafq3rFASqew",
},
},
{
"with timeout",
HeaderValue{`A3eqwsafq3rFASqew;timeout=47`},
&HeaderSession{
Session: "A3eqwsafq3rFASqew",
Timeout: func() *uint {
v := uint(47)
return &v
}(),
},
},
{
"with timeout and space",
HeaderValue{`A3eqwsafq3rFASqew; timeout=47`},
&HeaderSession{
Session: "A3eqwsafq3rFASqew",
Timeout: func() *uint {
v := uint(47)
return &v
}(),
},
},
}
func TestHeaderSession(t *testing.T) {
for _, c := range casesHeaderSession {
t.Run(c.name, func(t *testing.T) {
req, err := ReadHeaderSession(c.value)
require.NoError(t, err)
require.Equal(t, c.hs, req)
})
}
}