2024-02-05 11:13:36 +00:00
|
|
|
package integration
|
|
|
|
|
|
|
|
import (
|
2024-11-26 15:28:42 +00:00
|
|
|
"gitea.pena/PenaSide/customer/internal/interface/client"
|
|
|
|
"gitea.pena/PenaSide/customer/internal/models"
|
2024-02-05 11:13:36 +00:00
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSendMessage(t *testing.T) {
|
|
|
|
sender := "noreply@mailing.pena.digital"
|
|
|
|
apiKey := "P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev"
|
|
|
|
|
2024-11-26 15:28:42 +00:00
|
|
|
mailClient := client.NewMailClient(models.MailClientCfg{
|
2024-02-05 11:13:36 +00:00
|
|
|
ApiUrl: "https://api.smtp.bz/v1/smtp/send",
|
|
|
|
Sender: sender,
|
|
|
|
ApiKey: apiKey,
|
|
|
|
FiberClient: fiber.AcquireClient(),
|
2024-05-21 13:50:26 +00:00
|
|
|
MailAddress: "pashamullin2001@gmail.com",
|
2024-11-26 15:28:42 +00:00
|
|
|
}, zap.NewExample())
|
2024-02-05 11:13:36 +00:00
|
|
|
|
|
|
|
userEmail := "test@example.com"
|
|
|
|
verification := &models.Verification{
|
|
|
|
UserID: "test",
|
|
|
|
Files: []models.VerificationFile{
|
|
|
|
{Name: "file1", URL: "http://test/file1"},
|
|
|
|
{Name: "file2", URL: "http://test/file2"},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2024-02-15 09:03:24 +00:00
|
|
|
err := mailClient.SendMessage(userEmail, verification, 10)
|
2024-02-05 11:13:36 +00:00
|
|
|
assert.NoError(t, err, "successful")
|
|
|
|
}
|