File: sessionKeyItem_test.go

package info (click to toggle)
golang-github-etherlabsio-go-m3u8 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 348 kB
  • sloc: makefile: 3
file content (24 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package test

import (
	"testing"

	"github.com/etherlabsio/go-m3u8/m3u8"
	"github.com/stretchr/testify/assert"
)

func TestSessionKeyItem_Parse(t *testing.T) {
	line := `#EXT-X-SESSION-KEY:METHOD=AES-128,URI="http://test.key",IV=D512BBF,KEYFORMAT="identity",KEYFORMATVERSIONS="1/3"`

	ski, err := m3u8.NewSessionKeyItem(line)
	assert.Nil(t, err)
	assert.NotNil(t, ski.Encryptable)

	assert.Equal(t, "AES-128", ski.Encryptable.Method)
	assertNotNilEqual(t, "http://test.key", ski.Encryptable.URI)
	assertNotNilEqual(t, "D512BBF", ski.Encryptable.IV)
	assertNotNilEqual(t, "identity", ski.Encryptable.KeyFormat)
	assertNotNilEqual(t, "1/3", ski.Encryptable.KeyFormatVersions)

	assertToString(t, line, ski)
}