mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Add new dependencies: `github.com/joho/godotenv`, `github.com/stretchr/testify`, and `gopkg.in/natefinch/lumberjack.v2` - Remove indirect dependency on `github.com/joho/godotenv` - Refactor JobRunDetails template to separate content rendering for improved testing - Enhance error message display in JobRunDetails template - Introduce new test files for JWT and password functionalities - Add comprehensive tests for database operations and error handling
36 lines
838 B
Go
36 lines
838 B
Go
package email
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/starfleetcptn/gomft/internal/config"
|
|
)
|
|
|
|
// MockService implements the email Service for testing purposes
|
|
type MockService struct {
|
|
SendEmailCalls int
|
|
SendPasswordResetEmailCalls int
|
|
ReturnError error
|
|
}
|
|
|
|
// NewMockService creates a new mock email service
|
|
func NewMockService() *Service {
|
|
// Create minimal config
|
|
cfg := &config.Config{
|
|
Email: config.EmailConfig{
|
|
Enabled: false,
|
|
},
|
|
BaseURL: "http://localhost:8080",
|
|
}
|
|
|
|
return &Service{
|
|
Config: cfg,
|
|
}
|
|
}
|
|
|
|
// SendPasswordResetEmail mocks sending a password reset email
|
|
func (s *MockService) SendPasswordResetEmail(toEmail, username, resetToken string) error {
|
|
return fmt.Errorf("email service is disabled, reset link would be: %s/reset-password?token=%s",
|
|
"http://localhost:8080", resetToken)
|
|
}
|