-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmailService_test.go
85 lines (79 loc) · 1.73 KB
/
mailService_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package services
import (
"fmt"
"testing"
)
var addMailID int64
var mailToken = testToken
func TestMailServerService_AddMailServer(t *testing.T) {
var m MailServerService
m.ClientID = "403"
m.Host = "http://localhost:3002"
m.Token = mailToken
var ms MailServer
ms.MailServer = "mail.some.com"
ms.SecureConnection = true
ms.Port = 465
ms.Debug = false
ms.Username = "ken"
ms.Password = "ken"
ms.FromAddress = "ken@ken.com"
ms.ClientID = 403
res := m.AddMailServer(&ms)
fmt.Print("mail server add res: ")
fmt.Println(res)
addMailID = res.ID
if res.Success != true {
t.Fail()
}
}
func TestMailServerService_UpdateMailServer(t *testing.T) {
var m MailServerService
m.ClientID = "403"
m.Host = "http://localhost:3002"
m.Token = mailToken
var ms MailServer
ms.ID = addMailID
ms.MailServer = "mail.some.com"
ms.SecureConnection = true
ms.Port = 465
ms.Debug = true
ms.Username = "ken"
ms.Password = "ken"
ms.FromAddress = "ken1@ken.com"
ms.ClientID = 403
res := m.UpdateMailServer(&ms)
fmt.Print("mail server add res: ")
fmt.Println(res)
addMailID = res.ID
if res.Success != true {
t.Fail()
}
}
func TestContentService_GetMailServer(t *testing.T) {
var m MailServerService
m.ClientID = "403"
m.Host = "http://localhost:3002"
m.Token = mailToken
res := m.GetMailServer()
fmt.Print("res server get: ")
fmt.Println(res)
if res.Success != true {
t.Fail()
}
}
// func TestMailServerService_SendMail(t *testing.T) {
// var m MailServerService
// m.ClientID = "403"
// m.Host = "http://localhost:3002"
// m.Token = token
// var ms MailMessage
// ms.FromEmail
// res := m.SendMail(&ms)
// fmt.Print("send mail res: ")
// fmt.Println(res)
// addMailID = res.ID
// if res.Success != true {
// t.Fail()
// }
// }