2024-02-05 11:13:36 +00:00
|
|
|
package integration
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/client"
|
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSendMessage(t *testing.T) {
|
|
|
|
sender := "noreply@mailing.pena.digital"
|
|
|
|
apiKey := "P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev"
|
|
|
|
|
|
|
|
mailClient := client.NewMailClient(client.MailClientDeps{
|
|
|
|
ApiUrl: "https://api.smtp.bz/v1/smtp/send",
|
|
|
|
Sender: sender,
|
|
|
|
ApiKey: apiKey,
|
|
|
|
Auth: &models.PlainAuth{Username: "kotilion.95@gmail.com", Password: "vWwbCSg4bf0p"},
|
|
|
|
FiberClient: fiber.AcquireClient(),
|
|
|
|
Logger: zap.NewExample(),
|
|
|
|
})
|
|
|
|
|
|
|
|
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")
|
|
|
|
}
|