From 067852b17f41884f29a4775ceef9fab1bda272a0 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sun, 29 Sep 2019 13:45:49 +0200 Subject: [PATCH] Add notification test stub --- tests/compose/notification_test.go | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/compose/notification_test.go diff --git a/tests/compose/notification_test.go b/tests/compose/notification_test.go new file mode 100644 index 000000000..ff3d736ea --- /dev/null +++ b/tests/compose/notification_test.go @@ -0,0 +1,35 @@ +package compose + +import ( + "encoding/json" + "net/http" + "testing" + + "github.com/cortezaproject/corteza-server/compose/rest/request" + sqlxTypes "github.com/jmoiron/sqlx/types" + "github.com/steinfletcher/apitest" +) + +func (h helper) apiSendEmailNotification(req request.NotificationEmailSend) *apitest.Response { + payload, err := json.Marshal(req) + h.a.NoError(err) + + return h.apiInit(). + Post("/notification/email"). + JSON(string(payload)). + Expect(h.t). + Status(http.StatusOK) +} + +func TestEmailNotification(t *testing.T) { + t.Skip("we need smtp server mock") + h := newHelper(t) + + h.apiSendEmailNotification(request.NotificationEmailSend{ + To: []string{"foo+to@test.tld"}, + Cc: []string{"foo+cc1@test.tld", "foo+cc2@test.tld"}, + Subject: "Subject!", + Content: sqlxTypes.JSONText(`{}`), + RemoteAttachments: []string{"file1", "file2"}, + }).End() +}