fix: security tests with mock email sender and rate limit isolation
- Add EmailSender interface to allow mocking in tests - Add IsInitialized() method to template.Manager for nil-safe checks - Update contact handler to use interface and safe initialization checks - Add mockEmailSender in security tests to avoid SMTP connection attempts - Use unique IPs per test case to avoid rate limiting interference
This commit is contained in:
@@ -17,6 +17,12 @@ type Manager struct {
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
// IsInitialized returns true if the template manager has been properly initialized
|
||||
// with a config. Empty Manager structs (e.g., in tests) will return false.
|
||||
func (m *Manager) IsInitialized() bool {
|
||||
return m != nil && m.config != nil
|
||||
}
|
||||
|
||||
// NewManager creates a new template manager
|
||||
func NewManager(cfg *config.TemplateConfig) (*Manager, error) {
|
||||
m := &Manager{
|
||||
|
||||
Reference in New Issue
Block a user