test: add test reliability plan and device test coverage
- Add TEST_RELIABILITY_PLAN.md documenting test strategy - Add devices_test.go with device handler tests - Add device_auth_test.go with device authentication middleware tests
This commit is contained in:
@@ -204,12 +204,14 @@ func setupDeviceTest(t *testing.T) *TestDeviceSetup {
|
||||
func createTestUserOnce(t *testing.T, db *database.Queries) UserTestData {
|
||||
ctx := context.Background()
|
||||
|
||||
// Clean up any existing test user first
|
||||
// Return error if user already exists
|
||||
existingUser, err := db.GetUserByEmail(ctx, "testuser@example.com")
|
||||
if err == nil {
|
||||
db.DeleteUser(ctx, existingUser.ID)
|
||||
return fmt.Errorf("user already exists: %s", existingUser.Email)
|
||||
}
|
||||
|
||||
return UserTestData{}
|
||||
|
||||
// Create user with known credentials
|
||||
passwordHash := "$2a$10$JjAtK7PPa1WexQC3AUGe8OXLeuseZ/haN1Mz7emMo6CfOvMiTVXWq"
|
||||
user, err := db.CreateUser(ctx, database.CreateUserParams{
|
||||
|
||||
Reference in New Issue
Block a user