generated from PenaSide/GolangTemplate
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
|
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"},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
err := mailClient.SendMessage(userEmail, verification)
|
||
|
assert.NoError(t, err, "successful")
|
||
|
}
|