Ability to set name on Participant (#293)

This commit is contained in:
David Zhao
2021-12-28 00:12:04 -08:00
committed by GitHub
parent b747cdb822
commit 3108ef22ad
9 changed files with 20 additions and 7 deletions
+6 -4
View File
@@ -228,7 +228,9 @@ func redisClient() *redis.Client {
func joinToken(room, name string) string {
at := auth.NewAccessToken(testApiKey, testApiSecret).
AddGrant(&auth.VideoGrant{RoomJoin: true, Room: room}).
SetIdentity(name)
SetIdentity(name).
SetName(name).
SetMetadata("metadata" + name)
t, err := at.ToJWT()
if err != nil {
panic(err)
@@ -239,7 +241,8 @@ func joinToken(room, name string) string {
func joinTokenWithGrant(name string, grant *auth.VideoGrant) string {
at := auth.NewAccessToken(testApiKey, testApiSecret).
AddGrant(grant).
SetIdentity(name)
SetIdentity(name).
SetName(name)
t, err := at.ToJWT()
if err != nil {
panic(err)
@@ -249,8 +252,7 @@ func joinTokenWithGrant(name string, grant *auth.VideoGrant) string {
func createRoomToken() string {
at := auth.NewAccessToken(testApiKey, testApiSecret).
AddGrant(&auth.VideoGrant{RoomCreate: true}).
SetIdentity("testuser")
AddGrant(&auth.VideoGrant{RoomCreate: true})
t, err := at.ToJWT()
if err != nil {
panic(err)
+4
View File
@@ -52,6 +52,10 @@ func TestMultiNodeRouting(t *testing.T) {
require.Equal(t, c1.ID(), streamID)
return true
})
remoteC1 := c2.GetRemoteParticipant(c1.ID())
require.Equal(t, "c1", remoteC1.Name)
require.Equal(t, "metadatac1", remoteC1.Metadata)
}
func TestConnectWithoutCreation(t *testing.T) {