This repository was archived by the owner on Sep 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
13
13
"github.com/staticbackendhq/core/cache"
14
14
"github.com/staticbackendhq/core/database/mongo"
15
15
"github.com/staticbackendhq/core/database/postgresql"
16
+ "github.com/staticbackendhq/core/email"
16
17
"github.com/staticbackendhq/core/internal"
17
18
)
18
19
@@ -56,6 +57,13 @@ func TestMain(m *testing.M) {
56
57
57
58
database = & Database {cache : volatile }
58
59
60
+ mp := os .Getenv ("MAIL_PROVIDER" )
61
+ if strings .EqualFold (mp , internal .MailProviderSES ) {
62
+ emailer = email.AWSSES {}
63
+ } else {
64
+ emailer = email.Dev {}
65
+ }
66
+
59
67
deleteAndSetupTestAccount ()
60
68
61
69
hub := newHub (volatile )
Original file line number Diff line number Diff line change 1
1
package staticbackend
2
2
3
3
import (
4
+ "os"
4
5
"testing"
5
6
6
- "github.com/staticbackendhq/core/email"
7
7
"github.com/staticbackendhq/core/internal"
8
8
)
9
9
10
- func Test_Sendmail_AWS (t * testing.T ) {
11
- emailer := & email.AWSSES {}
12
-
10
+ func Test_Sendmail (t * testing.T ) {
13
11
data := internal.SendMailData {
14
- FromName : "My name here" ,
15
-
16
-
12
+ FromName : os . Getenv ( "FROM_NAME" ) ,
13
+ From : os . Getenv ( "FROM_EMAIL" ) ,
14
+ To : "dominicstpierre+unittest @gmail.com" ,
17
15
ToName : "Dominic St-Pierre" ,
18
16
Subject : "From unit test" ,
19
17
HTMLBody : "<h1>hello</h1><p>working</p>" ,
20
18
TextBody : "Hello\n working" ,
21
-
19
+ ReplyTo : os . Getenv ( "FROM_EMAIL" ) ,
22
20
}
23
21
if err := emailer .Send (data ); err != nil {
24
22
t .Error (err )
You can’t perform that action at this time.
0 commit comments