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.
This commit is contained in:
@@ -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!",
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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!",
|
||||
}
|
||||
|
||||
|
||||
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user