Skip to content

Commit

Permalink
[feat]补充rtsp Basic论证测试
Browse files Browse the repository at this point in the history
  • Loading branch information
joestarzxh committed Mar 16, 2022
1 parent f982ab9 commit ca8923a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/rtsp/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@ func TestGetRtspFirstAuth(t *testing.T) {
assert.Equal(t, "admin", rtspAuth.Username)
assert.Equal(t, "admin123", rtspAuth.Password)
}

func TestRtspBasicAuth(t *testing.T) {
var rtspAuth rtsp.Auth
auths := make([]string, 1)
auths[0] = `Basic realm="MediaServer3.0"`
username := "admin"
password := "admin"
rtspAuth.FeedWwwAuthenticate(auths, username, password)
basicAuthStr:=rtspAuth.MakeAuthorization("OPTIONS","rtsp://35.13.202.5:554/cam/realmonitor?channel=1&subtype=0")

assert.Equal(t, rtsp.AuthTypeBasic, rtspAuth.Typ)
assert.Equal(t, "Basic YWRtaW46YWRtaW4=", basicAuthStr)
}

0 comments on commit ca8923a

Please sign in to comment.