mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-10-04 14:22:41 +08:00
Add the possibility to change whitelist protocols
This commit is contained in:
28
transcoder/transcored_test.go
Normal file
28
transcoder/transcored_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package transcoder
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/xfrr/goffmpeg/models"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTranscoder(t *testing.T) {
|
||||
t.Run("#SetWhiteListProtocols", func(t *testing.T) {
|
||||
t.Run("Should not set -protocol_whitelist option if it isn't present", func(t *testing.T) {
|
||||
ts := Transcoder{}
|
||||
|
||||
ts.SetMediaFile(&models.Mediafile{})
|
||||
require.NotEqual(t, ts.GetCommand()[0:2], []string{"-protocol_whitelist", "file,http,https,tcp,tls"})
|
||||
require.NotContains(t, ts.GetCommand(), "protocol_whitelist")
|
||||
})
|
||||
|
||||
t.Run("Should set -protocol_whitelist option if it's present", func(t *testing.T) {
|
||||
ts := Transcoder{}
|
||||
|
||||
ts.SetMediaFile(&models.Mediafile{})
|
||||
ts.SetWhiteListProtocols([]string{"file","http","https","tcp","tls"})
|
||||
|
||||
require.Equal(t, ts.GetCommand()[0:2], []string{"-protocol_whitelist", "file,http,https,tcp,tls"})
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user