test: add WebSocket integration tests
Add comprehensive WebSocket test coverage: - TestWebSocketConnection: Basic connection and JWT auth - TestWebSocketDeviceAuth: Device token authentication - TestWebSocketProgressBroadcast: Real-time update delivery - TestWebSocketPingPong: Heartbeat mechanism - TestWebSocketConnectionLimit: Multiple concurrent connections - TestWebSocketInvalidToken: Rejection of invalid tokens - Helper function for test media item creation Update test helpers to create ConnectionManager for tests. Tests verify WebSocket connection, authentication, and real-time progress broadcast functionality.
This commit is contained in:
@@ -119,7 +119,7 @@ func TestListDevices(t *testing.T) {
|
||||
defer ts.Close()
|
||||
|
||||
// Login to get token
|
||||
token := loginTestUser(t, ts)
|
||||
token := loginTestUser(t, ts, db)
|
||||
|
||||
// Create a device directly in the database
|
||||
userID := getTestUserID(t, db)
|
||||
@@ -164,7 +164,7 @@ func TestUpdateDevice(t *testing.T) {
|
||||
defer ts.Close()
|
||||
|
||||
// Login to get token
|
||||
token := loginTestUser(t, ts)
|
||||
token := loginTestUser(t, ts, db)
|
||||
|
||||
// Create a device directly in the database
|
||||
userID := getTestUserID(t, db)
|
||||
@@ -220,7 +220,7 @@ func TestDeleteDevice(t *testing.T) {
|
||||
defer ts.Close()
|
||||
|
||||
// Login to get token
|
||||
token := loginTestUser(t, ts)
|
||||
token := loginTestUser(t, ts, db)
|
||||
|
||||
// Create a device directly in the database
|
||||
userID := getTestUserID(t, db)
|
||||
|
||||
Reference in New Issue
Block a user