mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 14:52:46 +08:00

* split tracks from medias * move tracks into dedicated package * move media into dedicated package * edit Medias.Marshal() in order to return SDP * add medias.Find() and simplify examples * improve coverage * fix rebase errors * replace TrackIDs with MediaIDs * implement media-specific and track-specific callbacks for reading RTCP and RTP packets * rename publish into record, read into play * add v2 tag * rename tracks into formats
54 lines
1020 B
Go
54 lines
1020 B
Go
package auth
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/aler9/gortsplib/v2/pkg/base"
|
|
)
|
|
|
|
func TestSenderErrors(t *testing.T) {
|
|
for _, ca := range []struct {
|
|
name string
|
|
hv base.HeaderValue
|
|
err string
|
|
}{
|
|
{
|
|
"invalid method",
|
|
base.HeaderValue{`Invalid`},
|
|
"no authentication methods available",
|
|
},
|
|
{
|
|
"digest invalid",
|
|
base.HeaderValue{`Digest`},
|
|
"unable to split between method and keys (Digest)",
|
|
},
|
|
{
|
|
"digest, missing realm",
|
|
base.HeaderValue{`Digest nonce=123`},
|
|
"realm is missing",
|
|
},
|
|
{
|
|
"digest, missing nonce",
|
|
base.HeaderValue{`Digest realm=123`},
|
|
"nonce is missing",
|
|
},
|
|
{
|
|
"basic invalid",
|
|
base.HeaderValue{`Basic`},
|
|
"unable to split between method and keys (Basic)",
|
|
},
|
|
{
|
|
"basic, missing realm",
|
|
base.HeaderValue{`Basic nonce=123`},
|
|
"realm is missing",
|
|
},
|
|
} {
|
|
t.Run(ca.name, func(t *testing.T) {
|
|
_, err := NewSender(ca.hv, "myuser", "mypass")
|
|
require.EqualError(t, err, ca.err)
|
|
})
|
|
}
|
|
}
|