diff --git a/ably/auth_integration_test.go b/ably/auth_integration_test.go index 3f4fce7a..b19ad264 100644 --- a/ably/auth_integration_test.go +++ b/ably/auth_integration_test.go @@ -344,9 +344,17 @@ func TestAuth_RequestToken(t *testing.T) { } } -func TestAuth_JWT_Token(t *testing.T) { +func TestAuth_JWT_Token_RSA8c(t *testing.T) { - t.Run("Should be able to authenticate using authURL", func(t *testing.T) { + t.Run("Get JWT from echo server", func(t *testing.T) { + app := ablytest.MustSandbox(nil) + defer safeclose(t, app) + jwt, err := app.CreateJwt(3 * time.Second) + assert.NoError(t, err) + assert.True(t, strings.HasPrefix(jwt, "ey")) + }) + + t.Run("RSA8g, RSA3d: Should be able to authenticate using authURL", func(t *testing.T) { app := ablytest.MustSandbox(nil) defer safeclose(t, app) @@ -382,7 +390,7 @@ func TestAuth_JWT_Token(t *testing.T) { assert.Equal(t, "Bearer "+encodedToken, statsRequest.Header.Get("Authorization")) }) - t.Run("Should be able to authenticate using authCallback", func(t *testing.T) { + t.Run("RSA8g, RSA3d: Should be able to authenticate using authCallback", func(t *testing.T) { app := ablytest.MustSandbox(nil) defer safeclose(t, app) diff --git a/ably/realtime_conn_spec_integration_test.go b/ably/realtime_conn_spec_integration_test.go index c007ae26..838de2d9 100644 --- a/ably/realtime_conn_spec_integration_test.go +++ b/ably/realtime_conn_spec_integration_test.go @@ -3022,7 +3022,7 @@ func TestRealtimeConn_RTC8a_ExplicitAuthorizeWhileConnected(t *testing.T) { ablytest.Instantly.Recv(t, nil, authorizeDone, t.Fatalf) }) - t.Run("RTC8a4: reauthorize with JWT token", func(t *testing.T) { + t.Run("RTC8a4, RSA3d: reauthorize with JWT token", func(t *testing.T) { t.Parallel() app := ablytest.MustSandbox(nil) defer safeclose(t, app) @@ -3039,9 +3039,11 @@ func TestRealtimeConn_RTC8a_ExplicitAuthorizeWhileConnected(t *testing.T) { return ably.TokenString(jwtTokenString), nil } + realtimeMsgRecorder := NewMessageRecorder() realtime, err := ably.NewRealtime( ably.WithAutoConnect(false), ably.WithEnvironment(ablytest.Environment), + ably.WithDial(realtimeMsgRecorder.Dial), ably.WithAuthCallback(authCallback)) assert.NoError(t, err) @@ -3073,6 +3075,10 @@ func TestRealtimeConn_RTC8a_ExplicitAuthorizeWhileConnected(t *testing.T) { assert.True(t, strings.HasPrefix(authCallbackTokens[0], "ey")) assert.True(t, strings.HasPrefix(authCallbackTokens[1], "ey")) assertUnique(t, authCallbackTokens) + // 2 Dial attempts made + assert.Len(t, realtimeMsgRecorder.URLs(), 2) + assert.Equal(t, authCallbackTokens[0], realtimeMsgRecorder.URLs()[0].Query().Get("access_token")) + assert.Equal(t, authCallbackTokens[1], realtimeMsgRecorder.URLs()[1].Query().Get("access_token")) }) t.Run("RTC8a2: Failed reauth moves connection to FAILED", func(t *testing.T) {