-
Notifications
You must be signed in to change notification settings - Fork 15
/
license_test.go
49 lines (40 loc) · 8.53 KB
/
license_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
package widevine
import (
"testing"
)
func TestGetContentKey(t *testing.T) {
options := Options{
Key: key,
IV: iv,
Provider: "widevine_test",
}
wv := New(options)
contentID := "testing"
// Make the request to generate or get a content key.
policy := Policy{
ContentID: contentID,
Tracks: []string{"SD", "HD", "AUDIO"},
DRMTypes: []string{"WIDEVINE"},
Policy: "default",
}
resp := wv.GetContentKey(contentID, policy)
if resp.Status != "OK" {
t.Error()
}
}
func TestGetLicense(t *testing.T) {
options := Options{
Key: key,
IV: iv,
Provider: "widevine_test",
}
wv := New(options)
contentID := "fkj3ljaSdfalkr3j"
resp := wv.GetLicense(contentID, testLicenseChallenge)
if resp.Status != "OK" {
t.Error()
}
}
// Test Challenge simulating a request from a Widevine CDM payload.
// https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-dash-widevine.ism/.mpd
const testLicenseChallenge = `CAESrSsSMAouChgiEGZrajNsamFTZGZhbGtyM2pI49yVmwYQARoQu3Vayko4ZhfP2lfCWQD+DhgBIIzHxu8FMBVC7ioKEnN0YWdpbmcuZ29vZ2xlLmNvbRIQKHA0VMAI9jYYredEPbbEyBqwKGGmP9x097DeCTnqiY8TNYYpUIi+raHm1geSBhlMJpTgPHCoARPwEnUmj0QrRE0Oc2mVW3E1fBwFEiJVzboydy/c2UBknjnSc8KuvSBiquNz7JtNgaysOQ02h497goY//p+BeQOHO8GiiEw6WYBIi7//9kZKHJX1SoWx28sg6IgrHuqy12n/aWkFjmydBFjuq5kinDQbnKSgCgYgpP5k2P6gCP17Qy7RQWOgf2RqcJS9cQJDkl+chkmlkBSNefWEHAymeg23tzogjD8E6bcgIQcwzltWTSKzoX7LRQK9wBTHsJD5G2C7UBfA7gbNfCphJ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