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:
2026-01-30 21:48:30 -05:00
parent d77585a6f5
commit 77d683277a
4 changed files with 288 additions and 15 deletions
+3 -3
View File
@@ -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)