From 89732b041b40dddf0852433f10a21c7f696d77c3 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 22 Feb 2026 11:21:00 -0500 Subject: [PATCH] test: update test files to use @tests.bookhoard.internal domain Update email domain in remaining test files: - device_cap_test.go - device_test.go - queue_test.go - refresh_token_test.go - seven_day_session_test.go All test files now consistently use the dedicated test domain to prevent conflicts with real user data. --- cmd/server/tests/device_cap_test.go | 2 +- cmd/server/tests/device_test.go | 2 +- cmd/server/tests/queue_test.go | 4 ++-- cmd/server/tests/refresh_token_test.go | 8 ++++---- cmd/server/tests/seven_day_session_test.go | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/server/tests/device_cap_test.go b/cmd/server/tests/device_cap_test.go index bbd4959..77ff629 100644 --- a/cmd/server/tests/device_cap_test.go +++ b/cmd/server/tests/device_cap_test.go @@ -411,7 +411,7 @@ func createTestUserForMaxDevices(t *testing.T, ts *httptest.Server, adminToken s func getAdminToken(t *testing.T, ts *httptest.Server, userID uuid.UUID) string { // First, try to login as the admin user (testuser who was created with admin role) loginPayload := map[string]interface{}{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } diff --git a/cmd/server/tests/device_test.go b/cmd/server/tests/device_test.go index 6bd8696..5372314 100644 --- a/cmd/server/tests/device_test.go +++ b/cmd/server/tests/device_test.go @@ -68,7 +68,7 @@ func TestDeviceRegistrationFlow(t *testing.T) { // Step 3: Login as user to approve device loginRequest := map[string]interface{}{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } loginBody, _ := json.Marshal(loginRequest) diff --git a/cmd/server/tests/queue_test.go b/cmd/server/tests/queue_test.go index 39879a3..69ef921 100644 --- a/cmd/server/tests/queue_test.go +++ b/cmd/server/tests/queue_test.go @@ -171,7 +171,7 @@ func TestRetryQueueItem(t *testing.T) { token := setup.Token // Get the current test user's ID from database - user, err := setup.DB.GetUserByEmail(context.Background(), "testuser@example.com") + user, err := setup.DB.GetUserByEmail(context.Background(), "testuser@tests.bookhoard.internal") require.NoError(t, err, "Should get test user") userID, err := uuid.FromBytes(user.ID.Bytes[:]) require.NoError(t, err, "Should parse user UUID") @@ -192,7 +192,7 @@ func TestDeleteQueueItem(t *testing.T) { token := setup.Token // Get the current test user's ID from database - user, err := setup.DB.GetUserByEmail(context.Background(), "testuser@example.com") + user, err := setup.DB.GetUserByEmail(context.Background(), "testuser@tests.bookhoard.internal") require.NoError(t, err, "Should get test user") userID, err := uuid.FromBytes(user.ID.Bytes[:]) require.NoError(t, err, "Should parse user UUID") diff --git a/cmd/server/tests/refresh_token_test.go b/cmd/server/tests/refresh_token_test.go index 2af5570..f310cb7 100644 --- a/cmd/server/tests/refresh_token_test.go +++ b/cmd/server/tests/refresh_token_test.go @@ -48,7 +48,7 @@ func TestRefreshTokenFlow(t *testing.T) { t.Run("RefreshToken_ValidToken", func(t *testing.T) { // First, login to get tokens loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } @@ -133,7 +133,7 @@ func TestRefreshTokenSecurity(t *testing.T) { t.Run("RefreshToken_ReuseProtection", func(t *testing.T) { // Login to get tokens loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } @@ -221,7 +221,7 @@ func TestRefreshTokenEdgeCases(t *testing.T) { t.Run("RefreshToken_ResponseStructure", func(t *testing.T) { // Login to get tokens loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } @@ -269,7 +269,7 @@ func TestRefreshTokenEdgeCases(t *testing.T) { t.Run("RefreshToken_TokenType", func(t *testing.T) { // Login to get tokens loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } diff --git a/cmd/server/tests/seven_day_session_test.go b/cmd/server/tests/seven_day_session_test.go index 758e978..071cf0c 100644 --- a/cmd/server/tests/seven_day_session_test.go +++ b/cmd/server/tests/seven_day_session_test.go @@ -24,7 +24,7 @@ func TestSevenDaySession(t *testing.T) { t.Run("Login returns 7-day session", func(t *testing.T) { loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } body, _ := json.Marshal(loginReq) @@ -70,7 +70,7 @@ func TestSevenDaySession(t *testing.T) { t.Run("Refresh token returns 7-day access token", func(t *testing.T) { // First login to get refresh token loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } loginBody, _ := json.Marshal(loginReq) @@ -123,7 +123,7 @@ func TestSevenDaySession(t *testing.T) { t.Run("JWT token has 7-day expiration claim", func(t *testing.T) { loginReq := map[string]string{ - "login": "testuser@example.com", + "login": "testuser@tests.bookhoard.internal", "password": "Test@Pass123!", } body, _ := json.Marshal(loginReq) @@ -267,7 +267,7 @@ func TestNoClientSideCookies(t *testing.T) { t.Run("Login does not set document.cookie", func(t *testing.T) { // Use the standard test user loginData := url.Values{} - loginData.Set("login", "testuser@example.com") + loginData.Set("login", "testuser@tests.bookhoard.internal") loginData.Set("password", "Test@Pass123!") loginReq, err := http.NewRequest("POST", setup.Server.URL+"/api/auth/login", strings.NewReader(loginData.Encode()))