forked from openfresh/wse-rest-library-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdvrclip_test.go
80 lines (66 loc) · 1.45 KB
/
dvrclip_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package wserest
import (
"testing"
"time"
"github.com/sebastien4/wse-rest-library-go/entity/application/helper"
)
func TestDvrClip(t *testing.T) {
// Create settings
settings := helper.NewDefaultSettings()
settings.SetHost(WowzaHost)
settings.SetUsername(WowzaUsername)
settings.SetPassword(WowzaPassword)
sf := NewDvrClipExtraction(settings, "ndvr", "")
if UseWowza == "" {
return
}
response, err := sf.ClearCache()
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = sf.DebugConversions("tmp127")
if err != nil {
t.Fatal(err)
}
t.Log(response)
now := time.Now()
duration := time.Duration(5) * time.Second
response, err = sf.ConvertByDurationWithEndTime("tmp123", &now, &duration, "")
if err != nil {
t.Fatal(err)
}
t.Log(response)
hourago := time.Now().Add(-1 * time.Hour)
response, err = sf.ConvertByDurationWithStartTime("tmp123", &hourago, &duration, "")
if err != nil {
t.Fatal(err)
}
t.Log(response)
now = time.Now()
response, err = sf.Convert("tmp127", &now, nil, "")
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = sf.ConvertGroup([]string{"tmp123", "tmp124"})
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = sf.Convert("tmp123", nil, nil, "")
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = sf.GetItem("tmp123")
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = sf.GetAll()
if err != nil {
t.Fatal(err)
}
t.Log(response)
}