mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 15:46:51 +08:00
23 lines
557 B
Go
23 lines
557 B
Go
package gortsplib
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAuthClientServer(t *testing.T) {
|
|
as := NewAuthServer("testuser", "testpass")
|
|
wwwAuthenticate := as.GenerateHeader()
|
|
|
|
ac, err := NewAuthClient(wwwAuthenticate, "testuser", "testpass")
|
|
require.NoError(t, err)
|
|
authorization := ac.GenerateHeader(ANNOUNCE,
|
|
&url.URL{Scheme: "rtsp", Host: "myhost", Path: "mypath"})
|
|
|
|
err = as.ValidateHeader(authorization, ANNOUNCE,
|
|
&url.URL{Scheme: "rtsp", Host: "myhost", Path: "mypath"})
|
|
require.NoError(t, err)
|
|
}
|