chore: Refactor test setup for Gin framework
- Removed redundant `gin.SetMode(gin.TestMode)` calls from individual test files. - Introduced a centralized `TestMain` function in `testmain_test.go` to set the Gin mode for all tests. - Ensured consistent test environment setup across various handler test files.
This commit is contained in:
@@ -19,7 +19,6 @@ import (
|
||||
// 2. SecurityConfig DB (middle)
|
||||
// 3. Static config (lowest)
|
||||
func TestSecurityHandler_Priority_SettingsOverSecurityConfig(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -112,7 +111,6 @@ func TestSecurityHandler_Priority_SettingsOverSecurityConfig(t *testing.T) {
|
||||
|
||||
// TestSecurityHandler_Priority_AllModules verifies priority system works for all security modules
|
||||
func TestSecurityHandler_Priority_AllModules(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
db := setupTestDB(t)
|
||||
require.NoError(t, db.AutoMigrate(&models.Setting{}, &models.SecurityConfig{}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user