(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestTURNAuthHandler_HandleAuth_ValidCredentials(t *testing.T) { |
| 49 | h := newTestTurnAuthHandler() |
| 50 | pID := livekit.ParticipantID("PA_valid") |
| 51 | username, expectedKey := mustAuthCreds(t, h, pID, 300) |
| 52 | |
| 53 | for _, method := range []stun.Method{ |
| 54 | stun.MethodAllocate, |
| 55 | stun.MethodRefresh, |
| 56 | stun.MethodCreatePermission, |
| 57 | stun.MethodChannelBind, |
| 58 | stun.MethodSend, |
| 59 | } { |
| 60 | t.Run(method.String(), func(t *testing.T) { |
| 61 | userID, key, ok := h.HandleAuth(&turn.RequestAttributes{ |
| 62 | Username: username, |
| 63 | Realm: LivekitRealm, |
| 64 | SrcAddr: &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 1234}, |
| 65 | Method: method, |
| 66 | }) |
| 67 | require.True(t, ok) |
| 68 | require.Equal(t, string(pID), userID) |
| 69 | require.Equal(t, expectedKey, key) |
| 70 | }) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | func TestTURNAuthHandler_HandleAuth_ExpiredAllocateRejected(t *testing.T) { |
| 75 | h := newTestTurnAuthHandler() |
nothing calls this directly
no test coverage detected