Skip to content

Commit 009d028

Browse files
committed
Merge branch 'release/v1.20.7'
2 parents 4ff9fdf + 5131b6a commit 009d028

File tree

8 files changed

+375
-274
lines changed

8 files changed

+375
-274
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
Notable changes to Mailpit will be documented in this file.
44

5+
## [v1.20.7]
6+
7+
### Chore
8+
- Update caniemail database
9+
10+
### Fix
11+
- SQL error deleting a tag while using tenant-id ([#374](https://github.com/axllent/mailpit/issues/374))
12+
13+
### Testing
14+
- Add tenantIDs to tests
15+
16+
517
## [v1.20.6]
618

719
### Chore

config/config.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,9 @@ func VerifyConfig() error {
233233
return err
234234
}
235235

236-
TenantID = tools.Normalize(TenantID)
236+
TenantID = DBTenantID(TenantID)
237237
if TenantID != "" {
238238
logger.Log().Infof("[db] using tenant \"%s\"", TenantID)
239-
re := regexp.MustCompile(`[^a-zA-Z0-9\_]`)
240-
TenantID = re.ReplaceAllString(TenantID, "_")
241-
if !strings.HasSuffix(TenantID, "_") {
242-
TenantID = TenantID + "_"
243-
}
244239
}
245240

246241
re := regexp.MustCompile(`.*:\d+$`)
@@ -632,3 +627,17 @@ func isValidURL(s string) bool {
632627

633628
return strings.HasPrefix(u.Scheme, "http")
634629
}
630+
631+
// DBTenantID converts a tenant ID to a DB-friendly value if set
632+
func DBTenantID(s string) string {
633+
s = tools.Normalize(s)
634+
if s != "" {
635+
re := regexp.MustCompile(`[^a-zA-Z0-9\_]`)
636+
s = re.ReplaceAllString(s, "_")
637+
if !strings.HasSuffix(s, "_") {
638+
s = s + "_"
639+
}
640+
}
641+
642+
return s
643+
}

internal/htmlcheck/caniemail-data.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"api_version":"1.0.4",
3-
"last_update_date":"2024-08-31 16:00:28 +0000",
3+
"last_update_date":"2024-10-09 08:12:03 +0000",
44
"nicenames":{"family":{"gmail":"Gmail","outlook":"Outlook","yahoo":"Yahoo! Mail","apple-mail":"Apple Mail","aol":"AOL","thunderbird":"Mozilla Thunderbird","microsoft":"Microsoft","samsung-email":"Samsung Email","sfr":"SFR","orange":"Orange","protonmail":"ProtonMail","hey":"HEY","mail-ru":"Mail.ru","fastmail":"Fastmail","laposte":"LaPoste.net","t-online-de":"T-online.de","free-fr":"Free.fr","gmx":"GMX","web-de":"WEB.DE","ionos-1and1":"1&1","rainloop":"RainLoop","wp-pl":"WP.pl"},"platform":{"desktop-app":"Desktop","desktop-webmail":"Desktop Webmail","mobile-webmail":"Mobile Webmail","webmail":"Webmail","ios":"iOS","android":"Android","windows":"Windows","macos":"macOS","windows-mail":"Windows Mail","outlook-com":"Outlook.com"},"support":{"supported":"Supported","mitigated":"Partially supported","unsupported":"Not supported","unknown":"Support unknown","mixed":"Mixed support"},"category":{"html":"HTML","css":"CSS","image":"Image formats","others":"Others"}},
55
"data":[
66
{
@@ -1406,7 +1406,7 @@
14061406
"last_test_date":"2019-10-01",
14071407
"test_url":"https://www.caniemail.com/tests/css-margin.html",
14081408
"test_results_url":"https://app.emailonacid.com/app/acidtest/UmR6V6XenYY9bQiABuLGZRRrdP3fj2ZraiJjEyi4WKBho/list",
1409-
"stats":{"apple-mail":{"macos":{"12.4":"y"},"ios":{"12.4":"y"}},"gmail":{"desktop-webmail":{"2019-10":"a #1"},"ios":{"2019-10":"a #1"},"android":{"2019-10":"a #1"},"mobile-webmail":{"2020-02":"a #1"}},"orange":{"desktop-webmail":{"2019-10":"y","2021-03":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"outlook":{"windows":{"2003":"y","2007":"a #1 #2 #3 #4","2010":"a #1 #2 #3 #4","2013":"a #1 #2 #3 #4","2016":"a #1 #2 #3 #4","2019":"a #1 #2 #3 #4"},"windows-mail":{"2019-10":"a #1 #2 #3"},"macos":{"2011":"y","2016":"y","16.80":"a #1"},"outlook-com":{"2019-10":"a #1","2023-12":"a #1"},"ios":{"2.51.1":"y","4.3.1":"a #1"},"android":{"2019-10":"a #1"}},"samsung-email":{"android":{"6.0":"y"}},"sfr":{"desktop-webmail":{"2019-10":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"thunderbird":{"macos":{"60.3":"y"}},"aol":{"desktop-webmail":{"2019-10":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"yahoo":{"desktop-webmail":{"2019-10":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"protonmail":{"desktop-webmail":{"2020-03":"y"},"ios":{"2020-03":"y"},"android":{"2020-03":"y"}},"hey":{"desktop-webmail":{"2020-06":"y"}},"mail-ru":{"desktop-webmail":{"2020-10":"a #1"}},"fastmail":{"desktop-webmail":{"2021-07":"y"}},"laposte":{"desktop-webmail":{"2021-08":"y"}},"gmx":{"desktop-webmail":{"2022-06":"y"},"ios":{"2022-06":"y"},"android":{"2022-06":"y"}},"web-de":{"desktop-webmail":{"2022-06":"y"},"ios":{"2022-06":"y"},"android":{"2022-06":"y"}},"ionos-1and1":{"desktop-webmail":{"2022-06":"y"},"android":{"2022-06":"y"}}},
1409+
"stats":{"apple-mail":{"macos":{"12.4":"y"},"ios":{"12.4":"y"}},"gmail":{"desktop-webmail":{"2019-10":"a #1"},"ios":{"2019-10":"a #1"},"android":{"2019-10":"a #1"},"mobile-webmail":{"2020-02":"a #1"}},"orange":{"desktop-webmail":{"2019-10":"y","2021-03":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"outlook":{"windows":{"2003":"y","2007":"a #1 #2 #3 #4","2010":"a #1 #2 #3 #4","2013":"a #1 #2 #3 #4","2016":"a #1 #2 #3 #4","2019":"a #1 #2 #3 #4"},"windows-mail":{"2019-10":"a #1 #2 #3"},"macos":{"2011":"y","2016":"y","16.80":"a #1"},"outlook-com":{"2019-10":"a #1","2023-12":"a #1"},"ios":{"2.51.1":"y","4.3.1":"a #1"},"android":{"2019-10":"a #1"}},"samsung-email":{"android":{"6.0":"y"}},"sfr":{"desktop-webmail":{"2019-10":"y"},"ios":{"2019-10":"y"},"android":{"2019-10":"y"}},"thunderbird":{"macos":{"60.3":"y"}},"aol":{"desktop-webmail":{"2019-10":"y","2024-10":"a #1"},"ios":{"2019-10":"y","2024-10":"a #1"},"android":{"2019-10":"y","2024-10":"a #1"}},"yahoo":{"desktop-webmail":{"2019-10":"y","2024-10":"a #1"},"ios":{"2019-10":"y","2024-10":"a #1"},"android":{"2019-10":"y","2024-10":"a #1"}},"protonmail":{"desktop-webmail":{"2020-03":"y"},"ios":{"2020-03":"y"},"android":{"2020-03":"y"}},"hey":{"desktop-webmail":{"2020-06":"y"}},"mail-ru":{"desktop-webmail":{"2020-10":"a #1"}},"fastmail":{"desktop-webmail":{"2021-07":"y"}},"laposte":{"desktop-webmail":{"2021-08":"y"}},"gmx":{"desktop-webmail":{"2022-06":"y"},"ios":{"2022-06":"y"},"android":{"2022-06":"y"}},"web-de":{"desktop-webmail":{"2022-06":"y"},"ios":{"2022-06":"y"},"android":{"2022-06":"y"}},"ionos-1and1":{"desktop-webmail":{"2022-06":"y"},"android":{"2022-06":"y"}}},
14101410
"notes":null,
14111411
"notes_by_num":{"1":"Partial. Negative values are not supported.","2":"Partial. Not supported on `<span>` and `<body>` elements.","3":"Buggy. `background-color` is included inside the `margin`.","4":"Partial. `auto` value is not supported."}
14121412
},
@@ -3219,6 +3219,22 @@
32193219
"notes_by_num":{"1":"Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not \"remove\" it from layout.","2":"Partially supported. `visibility:collapse` is not supported."}
32203220
},
32213221

3222+
{
3223+
"slug":"css-white-space-collapse",
3224+
"title":"white-space-collapse",
3225+
"description":"Controls how white space inside an element is collapsed.",
3226+
"url":"https://www.caniemail.com/features/css-white-space-collapse/",
3227+
"category":"css",
3228+
"tags":[],
3229+
"keywords":"break, space, collapse, hide",
3230+
"last_test_date":"2024-09-04",
3231+
"test_url":"https://www.caniemail.com/tests/css-white-space-collapse.html",
3232+
"test_results_url":"https://testi.at/proj/e6y4s3zytp5kty7kcg",
3233+
"stats":{"apple-mail":{"macos":{"10":"n","11":"n","12":"n","13":"n","14":"y #1"},"ios":{"15":"y #1"}},"gmail":{"desktop-webmail":{"2024-09":"n"},"ios":{"2024-09":"n"},"android":{"2024-09":"n"},"mobile-webmail":{"2024-09":"n"}},"orange":{"desktop-webmail":{"2024-09":"u"},"ios":{"2024-09":"u"},"android":{"2024-09":"u"}},"outlook":{"windows":{"2013":"n","2016":"n","2019":"n","2021":"n"},"windows-mail":{"2024-09":"n"},"macos":{"2024-09":"n"},"outlook-com":{"2024-09":"n"},"ios":{"2024-09":"n"},"android":{"2024-09":"n"}},"yahoo":{"desktop-webmail":{"2024-09":"n"},"ios":{"2024-09":"n"},"android":{"2024-09":"n"}},"aol":{"desktop-webmail":{"2024-09":"n"},"ios":{"2024-09":"n"},"android":{"2024-09":"n"}},"samsung-email":{"android":{"2024-09":"y #1"}},"sfr":{"desktop-webmail":{"2024-03":"u"},"ios":{"2024-03":"u"},"android":{"2024-03":"u"}},"protonmail":{"desktop-webmail":{"2024-09":"u"},"ios":{"2024-09":"u"},"android":{"2024-09":"u"}},"hey":{"desktop-webmail":{"2024-09":"u"}},"mail-ru":{"desktop-webmail":{"2024-09":"y #1"}},"fastmail":{"desktop-webmail":{"2024-09":"u"}}},
3234+
"notes":null,
3235+
"notes_by_num":{"1":"Partial. `preserve-spaces` value works only on Firefox."}
3236+
},
3237+
32223238
{
32233239
"slug":"css-white-space",
32243240
"title":"white-space",
@@ -4734,7 +4750,7 @@
47344750
"last_test_date":"2023-01-15",
47354751
"test_url":"https://www.caniemail.com/tests/images.html",
47364752
"test_results_url":"https://app.emailonacid.com/app/acidtest/xm1T5nQ1MKtHpVSJidhagmt3Z53CjqbkMhorlvuM0Gz57/list",
4737-
"stats":{"apple-mail":{"macos":{"13":"n","14":"y"},"ios":{"13":"n","14":"n","15":"y"}},"gmail":{"desktop-webmail":{"2020-02":"n","2023-01":"n","2024-07":"n"},"ios":{"2020-02":"a #1","2023-01":"a #1"},"android":{"2020-02":"a #1","2023-01":"a #1"},"mobile-webmail":{"2020-02":"n","2023-01":"n"}},"outlook":{"windows":{"2007":"n","2010":"n","2013":"n","2016":"n","2019":"n"},"windows-mail":{"2020-02":"y"},"macos":{"2016":"n","13.1":"y","16.80":"y"},"outlook-com":{"2020-02":"y","2024-01":"y"},"ios":{"2020-02":"n","2023-01":"y"},"android":{"2020-02":"y"}},"samsung-email":{"android":{"9.0":"y"}},"thunderbird":{"windows":{"2020-02":"y"},"macos":{"68.4":"y"}},"aol":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"yahoo":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"orange":{"desktop-webmail":{"2020-02":"y","2021-03":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"sfr":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"protonmail":{"desktop-webmail":{"2020-03":"y"},"ios":{"2020-03":"y"},"android":{"2020-03":"y"}},"hey":{"desktop-webmail":{"2020-06":"y"}},"mail-ru":{"desktop-webmail":{"2020-10":"n","2023-01":"n"}},"fastmail":{"desktop-webmail":{"2021-07":"y"}},"laposte":{"desktop-webmail":{"2021-08":"y"}},"gmx":{"desktop-webmail":{"2022-09":"y"},"ios":{"2022-09":"y"},"android":{"2022-09":"y"}},"web-de":{"desktop-webmail":{"2022-09":"y"},"ios":{"2022-09":"y"},"android":{"2022-09":"y"}},"ionos-1and1":{"desktop-webmail":{"2022-09":"y"},"android":{"2022-09":"y"}}},
4753+
"stats":{"apple-mail":{"macos":{"13":"n","14":"y"},"ios":{"13":"n","14":"n","15":"y"}},"gmail":{"desktop-webmail":{"2020-02":"n","2023-01":"n","2024-07":"n"},"ios":{"2020-02":"a #1","2023-01":"a #1"},"android":{"2020-02":"a #1","2023-01":"a #1"},"mobile-webmail":{"2020-02":"n","2023-01":"n"}},"outlook":{"windows":{"2007":"n","2010":"n","2013":"n","2016":"n","2019":"y"},"windows-mail":{"2020-02":"y"},"macos":{"2016":"n","13.1":"y","16.80":"y"},"outlook-com":{"2020-02":"y","2024-01":"y"},"ios":{"2020-02":"n","2023-01":"y"},"android":{"2020-02":"y"}},"samsung-email":{"android":{"9.0":"y"}},"thunderbird":{"windows":{"2020-02":"y"},"macos":{"68.4":"y"}},"aol":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"yahoo":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"orange":{"desktop-webmail":{"2020-02":"y","2021-03":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"sfr":{"desktop-webmail":{"2020-02":"y"},"ios":{"2020-02":"y"},"android":{"2020-02":"y"}},"protonmail":{"desktop-webmail":{"2020-03":"y"},"ios":{"2020-03":"y"},"android":{"2020-03":"y"}},"hey":{"desktop-webmail":{"2020-06":"y"}},"mail-ru":{"desktop-webmail":{"2020-10":"n","2023-01":"n"}},"fastmail":{"desktop-webmail":{"2021-07":"y"}},"laposte":{"desktop-webmail":{"2021-08":"y"}},"gmx":{"desktop-webmail":{"2022-09":"y"},"ios":{"2022-09":"y"},"android":{"2022-09":"y"}},"web-de":{"desktop-webmail":{"2022-09":"y"},"ios":{"2022-09":"y"},"android":{"2022-09":"y"}},"ionos-1and1":{"desktop-webmail":{"2022-09":"y"},"android":{"2022-09":"y"}}},
47384754
"notes":null,
47394755
"notes_by_num":{"1":"Partially supported. Only works with non Google accounts."}
47404756
},

internal/storage/messages_test.go

Lines changed: 107 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package storage
33
import (
44
"testing"
55
"time"
6+
7+
"github.com/axllent/mailpit/config"
68
)
79

810
func TestTextEmailInserts(t *testing.T) {
9-
setup()
11+
setup("")
1012
defer Close()
1113

1214
t.Log("Testing text email storage")
@@ -38,113 +40,140 @@ func TestTextEmailInserts(t *testing.T) {
3840
}
3941

4042
func TestMimeEmailInserts(t *testing.T) {
41-
setup()
42-
defer Close()
43+
for _, tenantID := range []string{"", "MyServer 3", "host.example.com"} {
44+
tenantID = config.DBTenantID(tenantID)
4345

44-
t.Log("Testing mime email storage")
46+
setup(tenantID)
4547

46-
start := time.Now()
48+
if tenantID == "" {
49+
t.Log("Testing mime email storage")
50+
} else {
51+
t.Logf("Testing mime email storage (tenant %s)", tenantID)
52+
}
4753

48-
for i := 0; i < testRuns; i++ {
49-
if _, err := Store(&testMimeEmail); err != nil {
54+
start := time.Now()
55+
56+
for i := 0; i < testRuns; i++ {
57+
if _, err := Store(&testMimeEmail); err != nil {
58+
t.Log("error ", err)
59+
t.Fail()
60+
}
61+
}
62+
63+
assertEqual(t, CountTotal(), float64(testRuns), "Incorrect number of mime emails stored")
64+
65+
t.Logf("Inserted %d text emails in %s", testRuns, time.Since(start))
66+
67+
delStart := time.Now()
68+
if err := DeleteAllMessages(); err != nil {
5069
t.Log("error ", err)
5170
t.Fail()
5271
}
53-
}
5472

55-
assertEqual(t, CountTotal(), float64(testRuns), "Incorrect number of mime emails stored")
73+
assertEqual(t, CountTotal(), float64(0), "incorrect number of mime emails deleted")
5674

57-
t.Logf("Inserted %d text emails in %s", testRuns, time.Since(start))
75+
t.Logf("Deleted %d mime emails in %s", testRuns, time.Since(delStart))
5876

59-
delStart := time.Now()
60-
if err := DeleteAllMessages(); err != nil {
61-
t.Log("error ", err)
62-
t.Fail()
77+
Close()
6378
}
64-
65-
assertEqual(t, CountTotal(), float64(0), "incorrect number of mime emails deleted")
66-
67-
t.Logf("Deleted %d mime emails in %s", testRuns, time.Since(delStart))
6879
}
6980

7081
func TestRetrieveMimeEmail(t *testing.T) {
71-
setup()
72-
defer Close()
82+
for _, tenantID := range []string{"", "MyServer 3", "host.example.com"} {
83+
tenantID = config.DBTenantID(tenantID)
7384

74-
t.Log("Testing mime email retrieval")
85+
setup(tenantID)
7586

76-
id, err := Store(&testMimeEmail)
77-
if err != nil {
78-
t.Log("error ", err)
79-
t.Fail()
80-
}
87+
if tenantID == "" {
88+
t.Log("Testing mime email retrieval")
89+
} else {
90+
t.Logf("Testing mime email retrieval (tenant %s)", tenantID)
91+
}
8192

82-
msg, err := GetMessage(id)
83-
if err != nil {
84-
t.Log("error ", err)
85-
t.Fail()
86-
}
93+
id, err := Store(&testMimeEmail)
94+
if err != nil {
95+
t.Log("error ", err)
96+
t.Fail()
97+
}
8798

88-
assertEqual(t, msg.From.Name, "Sender Smith", "\"From\" name does not match")
89-
assertEqual(t, msg.From.Address, "[email protected]", "\"From\" address does not match")
90-
assertEqual(t, msg.Subject, "inline + attachment", "subject does not match")
91-
assertEqual(t, len(msg.To), 1, "incorrect number of recipients")
92-
assertEqual(t, msg.To[0].Name, "Recipient Ross", "\"To\" name does not match")
93-
assertEqual(t, msg.To[0].Address, "[email protected]", "\"To\" address does not match")
94-
assertEqual(t, len(msg.Attachments), 1, "incorrect number of attachments")
95-
assertEqual(t, msg.Attachments[0].FileName, "Sample PDF.pdf", "attachment filename does not match")
96-
assertEqual(t, len(msg.Inline), 1, "incorrect number of inline attachments")
97-
assertEqual(t, msg.Inline[0].FileName, "inline-image.jpg", "inline attachment filename does not match")
98-
99-
attachmentData, err := GetAttachmentPart(id, msg.Attachments[0].PartID)
100-
if err != nil {
101-
t.Log("error ", err)
102-
t.Fail()
103-
}
104-
assertEqual(t, float64(len(attachmentData.Content)), msg.Attachments[0].Size, "attachment size does not match")
99+
msg, err := GetMessage(id)
100+
if err != nil {
101+
t.Log("error ", err)
102+
t.Fail()
103+
}
105104

106-
inlineData, err := GetAttachmentPart(id, msg.Inline[0].PartID)
107-
if err != nil {
108-
t.Log("error ", err)
109-
t.Fail()
105+
assertEqual(t, msg.From.Name, "Sender Smith", "\"From\" name does not match")
106+
assertEqual(t, msg.From.Address, "[email protected]", "\"From\" address does not match")
107+
assertEqual(t, msg.Subject, "inline + attachment", "subject does not match")
108+
assertEqual(t, len(msg.To), 1, "incorrect number of recipients")
109+
assertEqual(t, msg.To[0].Name, "Recipient Ross", "\"To\" name does not match")
110+
assertEqual(t, msg.To[0].Address, "[email protected]", "\"To\" address does not match")
111+
assertEqual(t, len(msg.Attachments), 1, "incorrect number of attachments")
112+
assertEqual(t, msg.Attachments[0].FileName, "Sample PDF.pdf", "attachment filename does not match")
113+
assertEqual(t, len(msg.Inline), 1, "incorrect number of inline attachments")
114+
assertEqual(t, msg.Inline[0].FileName, "inline-image.jpg", "inline attachment filename does not match")
115+
116+
attachmentData, err := GetAttachmentPart(id, msg.Attachments[0].PartID)
117+
if err != nil {
118+
t.Log("error ", err)
119+
t.Fail()
120+
}
121+
assertEqual(t, float64(len(attachmentData.Content)), msg.Attachments[0].Size, "attachment size does not match")
122+
123+
inlineData, err := GetAttachmentPart(id, msg.Inline[0].PartID)
124+
if err != nil {
125+
t.Log("error ", err)
126+
t.Fail()
127+
}
128+
assertEqual(t, float64(len(inlineData.Content)), msg.Inline[0].Size, "inline attachment size does not match")
129+
130+
Close()
110131
}
111-
assertEqual(t, float64(len(inlineData.Content)), msg.Inline[0].Size, "inline attachment size does not match")
112132
}
113133

114134
func TestMessageSummary(t *testing.T) {
115-
setup()
116-
defer Close()
135+
for _, tenantID := range []string{"", "MyServer 3", "host.example.com"} {
136+
tenantID = config.DBTenantID(tenantID)
117137

118-
t.Log("Testing message summary")
138+
setup(tenantID)
119139

120-
if _, err := Store(&testMimeEmail); err != nil {
121-
t.Log("error ", err)
122-
t.Fail()
123-
}
140+
if tenantID == "" {
141+
t.Log("Testing message summary")
142+
} else {
143+
t.Logf("Testing message summary (tenant %s)", tenantID)
144+
}
124145

125-
summaries, err := List(0, 0, 1)
126-
if err != nil {
127-
t.Log("error ", err)
128-
t.Fail()
129-
}
146+
if _, err := Store(&testMimeEmail); err != nil {
147+
t.Log("error ", err)
148+
t.Fail()
149+
}
150+
151+
summaries, err := List(0, 0, 1)
152+
if err != nil {
153+
t.Log("error ", err)
154+
t.Fail()
155+
}
130156

131-
assertEqual(t, len(summaries), 1, "Expected 1 result")
157+
assertEqual(t, len(summaries), 1, "Expected 1 result")
132158

133-
msg := summaries[0]
159+
msg := summaries[0]
134160

135-
assertEqual(t, msg.From.Name, "Sender Smith", "\"From\" name does not match")
136-
assertEqual(t, msg.From.Address, "[email protected]", "\"From\" address does not match")
137-
assertEqual(t, msg.Subject, "inline + attachment", "subject does not match")
138-
assertEqual(t, len(msg.To), 1, "incorrect number of recipients")
139-
assertEqual(t, msg.To[0].Name, "Recipient Ross", "\"To\" name does not match")
140-
assertEqual(t, msg.To[0].Address, "[email protected]", "\"To\" address does not match")
141-
assertEqual(t, msg.Snippet, "Message with inline image and attachment:", "\"Snippet\" does does not match")
142-
assertEqual(t, msg.Attachments, 1, "Expected 1 attachment")
143-
assertEqual(t, msg.MessageID, "[email protected]", "\"MessageID\" does not match")
161+
assertEqual(t, msg.From.Name, "Sender Smith", "\"From\" name does not match")
162+
assertEqual(t, msg.From.Address, "[email protected]", "\"From\" address does not match")
163+
assertEqual(t, msg.Subject, "inline + attachment", "subject does not match")
164+
assertEqual(t, len(msg.To), 1, "incorrect number of recipients")
165+
assertEqual(t, msg.To[0].Name, "Recipient Ross", "\"To\" name does not match")
166+
assertEqual(t, msg.To[0].Address, "[email protected]", "\"To\" address does not match")
167+
assertEqual(t, msg.Snippet, "Message with inline image and attachment:", "\"Snippet\" does does not match")
168+
assertEqual(t, msg.Attachments, 1, "Expected 1 attachment")
169+
assertEqual(t, msg.MessageID, "[email protected]", "\"MessageID\" does not match")
170+
171+
Close()
172+
}
144173
}
145174

146175
func BenchmarkImportText(b *testing.B) {
147-
setup()
176+
setup("")
148177
defer Close()
149178

150179
for i := 0; i < b.N; i++ {
@@ -156,7 +185,7 @@ func BenchmarkImportText(b *testing.B) {
156185
}
157186

158187
func BenchmarkImportMime(b *testing.B) {
159-
setup()
188+
setup("")
160189
defer Close()
161190

162191
for i := 0; i < b.N; i++ {

0 commit comments

Comments
 (0)