improve coverage

This commit is contained in:
aler9
2022-12-11 23:36:43 +01:00
parent 0c13440721
commit 46cbb885b7
22 changed files with 126 additions and 44 deletions

View File

@@ -78,7 +78,7 @@ func TestAuth(t *testing.T) {
req.URL = mustParseURL("rtsp://myhost/mypath")
err = va.ValidateRequest(req)
err = va.ValidateRequest(req, nil)
if conf != "nofail" {
require.Error(t, err)
@@ -93,7 +93,7 @@ func TestAuth(t *testing.T) {
func TestAuthVLC(t *testing.T) {
for _, ca := range []struct {
clientURL string
serverURL string
mediaURL string
}{
{
"rtsp://myhost/mypath/",
@@ -115,11 +115,13 @@ func TestAuthVLC(t *testing.T) {
URL: mustParseURL(ca.clientURL),
}
se.AddAuthorization(req)
req.URL = mustParseURL(ca.mediaURL)
req.URL = mustParseURL(ca.serverURL)
err = va.ValidateRequest(req)
err = va.ValidateRequest(req, mustParseURL(ca.clientURL))
require.NoError(t, err)
err = va.ValidateRequest(req, mustParseURL("rtsp://invalid"))
require.Error(t, err)
}
}
@@ -155,7 +157,7 @@ func TestAuthHashed(t *testing.T) {
}
va.AddAuthorization(req)
err = se.ValidateRequest(req)
err = se.ValidateRequest(req, nil)
if conf != "nofail" {
require.Error(t, err)