From 1b69bec12f87992b2c5e331eecdabb0c9119b681 Mon Sep 17 00:00:00 2001 From: David Folch Agulles Date: Thu, 27 Nov 2025 23:38:36 +0100 Subject: [PATCH] Fix integration tests to comply with password requirements Update test passwords from 'password123' to 'Password123!' to meet security requirements (uppercase, lowercase, digit, special char). Fix migrations test to match actual habit_entries schema (removed non-existent deleted_at column). --- .../infrastructure/http/auth_integration_test.go | 14 +++++++------- .../http/habit_entries_integration_test.go | 2 +- .../infrastructure/http/habit_integration_test.go | 4 ++-- .../persistence/sqlite/migrations_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/infrastructure/http/auth_integration_test.go b/internal/infrastructure/http/auth_integration_test.go index e703ddf..688178d 100644 --- a/internal/infrastructure/http/auth_integration_test.go +++ b/internal/infrastructure/http/auth_integration_test.go @@ -12,7 +12,7 @@ func TestAuthFlow(t *testing.T) { t.Run("Register new user", func(t *testing.T) { reqBody := RegisterRequest{ Email: "test@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } @@ -36,7 +36,7 @@ func TestAuthFlow(t *testing.T) { t.Run("Register duplicate email", func(t *testing.T) { reqBody := RegisterRequest{ Email: "duplicate@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } @@ -52,7 +52,7 @@ func TestAuthFlow(t *testing.T) { t.Run("Register with invalid email", func(t *testing.T) { reqBody := RegisterRequest{ Email: "invalid-email", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } @@ -80,14 +80,14 @@ func TestAuthFlow(t *testing.T) { t.Run("Login with valid credentials", func(t *testing.T) { registerBody := RegisterRequest{ Email: "login@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } makeRequest(t, *ts.Router, "POST", "/api/v1/auth/register", registerBody, "") loginBody := LoginRequest{ Email: "login@example.com", - Password: "password123", + Password: "Password123!", } rr := makeRequest(t, *ts.Router, "POST", "/api/v1/auth/login", loginBody, "") @@ -107,7 +107,7 @@ func TestAuthFlow(t *testing.T) { t.Run("Login with invalid password", func(t *testing.T) { registerBody := RegisterRequest{ Email: "wrongpass@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } makeRequest(t, *ts.Router, "POST", "/api/v1/auth/register", registerBody, "") @@ -127,7 +127,7 @@ func TestAuthFlow(t *testing.T) { t.Run("Login with non-existent user", func(t *testing.T) { loginBody := LoginRequest{ Email: "nonexistent@example.com", - Password: "password123", + Password: "Password123!", } rr := makeRequest(t, *ts.Router, "POST", "/api/v1/auth/login", loginBody, "") diff --git a/internal/infrastructure/http/habit_entries_integration_test.go b/internal/infrastructure/http/habit_entries_integration_test.go index 97a868b..b377742 100644 --- a/internal/infrastructure/http/habit_entries_integration_test.go +++ b/internal/infrastructure/http/habit_entries_integration_test.go @@ -12,7 +12,7 @@ func TestHabitEntriesFlow(t *testing.T) { registerBody := RegisterRequest{ Email: "entryuser@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } rr := makeRequest(t, *ts.Router, "POST", "/api/v1/auth/register", registerBody, "") diff --git a/internal/infrastructure/http/habit_integration_test.go b/internal/infrastructure/http/habit_integration_test.go index 2356686..86fef53 100644 --- a/internal/infrastructure/http/habit_integration_test.go +++ b/internal/infrastructure/http/habit_integration_test.go @@ -11,7 +11,7 @@ func TestHabitCRUDFlow(t *testing.T) { registerBody := RegisterRequest{ Email: "habituser@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } rr := makeRequest(t, *ts.Router, "POST", "/api/v1/auth/register", registerBody, "") @@ -133,7 +133,7 @@ func TestHabitCRUDFlow(t *testing.T) { t.Run("Access other user's habit", func(t *testing.T) { registerBody := RegisterRequest{ Email: "otheruser@example.com", - Password: "password123", + Password: "Password123!", Timezone: "UTC", } rr := makeRequest(t, *ts.Router, "POST", "/api/v1/auth/register", registerBody, "") diff --git a/internal/infrastructure/persistence/sqlite/migrations_test.go b/internal/infrastructure/persistence/sqlite/migrations_test.go index ccc5168..065550d 100644 --- a/internal/infrastructure/persistence/sqlite/migrations_test.go +++ b/internal/infrastructure/persistence/sqlite/migrations_test.go @@ -94,7 +94,7 @@ func TestHabitEntriesTableSchema(t *testing.T) { t.Fatalf("RunMigrations failed: %v", err) } - columns := []string{"id", "habit_id", "scheduled_date", "completed_at", "value", "deleted_at"} + columns := []string{"id", "habit_id", "scheduled_date", "completed_at", "value"} for _, col := range columns { query := "SELECT " + col + " FROM habit_entries LIMIT 0" rows, err := db.Query(query)