Debian Codegraph @

attachments_test.go

raw symbols SCIP
1 package mailyakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.12 bytes/"
5 "encoding/base64scip-go gomod github.com/golang/go/src go1.12 `encoding/base64`/"
6 "ioscip-go gomod github.com/golang/go/src go1.12 io/"
7 "net/textprotoscip-go gomod github.com/golang/go/src go1.12 `net/textproto`/"
8 "stringsscip-go gomod github.com/golang/go/src go1.12 strings/"
9 "testingscip-go gomod github.com/golang/go/src go1.12 testing/"
10 )
11
12 type testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment# struct {
13 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType. string
14 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition. string
15 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data. bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#
16 }
17
18 // Satisfy the partCreator interface and keep track of wrote attachments
19 type testPartCreatorscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator# struct {
20 attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments. []*testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#
21 }
22
23 func (t *testPartCreatorscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#) CreatePartscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#CreatePart().(header textprotoscip-go gomod github.com/golang/go/src go1.12 `net/textproto`/.MIMEHeaderscip-go gomod github.com/golang/go/src go1.12 `net/textproto`/MIMEHeader#) (ioscip-go gomod github.com/golang/go/src go1.12 io/.Writerscip-go gomod github.com/golang/go/src go1.12 io/Writer#, error) {
24 a := &testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
25 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: header.Getscip-go gomod github.com/golang/go/src go1.12 `net/textproto`/MIMEHeader#Get().("Content-Type"),
26 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: header.Getscip-go gomod github.com/golang/go/src go1.12 `net/textproto`/MIMEHeader#Get().("Content-Disposition"),
27 }
28
29 t.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments. = append(t.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments., a)
30 return &a.datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data., nil
31 }
32
33 // nopSplitter - it does nothing!
34 type nopSplitterscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter# struct {
35 wscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#w. ioscip-go gomod github.com/golang/go/src go1.12 io/.Writerscip-go gomod github.com/golang/go/src go1.12 io/Writer#
36 }
37
38 func (t nopSplitterscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#) Writescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#Write().(p []byte) (int, error) {
39 return t.wscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#w..Writescip-go gomod github.com/golang/go/src go1.12 io/Writer#Write().(p)
40 }
41
42 // nopBuilder satisfies the writeWrapper interface
43 type nopBuilderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopBuilder# struct{}
44
45 func (b nopBuilderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopBuilder#) newscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopBuilder#new().(w ioscip-go gomod github.com/golang/go/src go1.12 io/.Writerscip-go gomod github.com/golang/go/src go1.12 io/Writer#) ioscip-go gomod github.com/golang/go/src go1.12 io/.Writerscip-go gomod github.com/golang/go/src go1.12 io/Writer# {
46 return &nopSplitterscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#{wscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopSplitter#w.: w}
47 }
48
49 // TestMailYakAttach calls Attach() and ensures the attachment slice is the
50 // correct length
51 func TestMailYakAttachscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakAttach().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
52 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
53
54 tests := []struct {
55 // Test description.
56 name string
57 // Receiver fields.
58 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
59 // Parameters.
60 pname string
61 r ioscip-go gomod github.com/golang/go/src go1.12 io/.Readerscip-go gomod github.com/golang/go/src go1.12 io/Reader#
62 // Expect
63 count int
64 }{
65 {
66 "From empty",
67 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{},
68 "test",
69 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
70 1,
71 },
72 {
73 "From one",
74 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Existing", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, ""}},
75 "test",
76 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
77 2,
78 },
79 }
80 for _, tt := range tests {
81 tt := tt
82 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
83 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
84
85 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
86 m.Attachscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Attach().(tt.pname, tt.r)
87
88 if tt.count != len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.) {
89 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Attach() len = %v, wantLen %v", tt.name, len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.), tt.count)
90 }
91 })
92 }
93 }
94
95 // TestMailYakAttach calls AttachInline() and ensures the attachment slice is the
96 // correct length
97 func TestMailYakAttachInlinescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakAttachInline().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
98 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
99
100 tests := []struct {
101 // Test description.
102 name string
103 // Receiver fields.
104 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
105 // Parameters.
106 pname string
107 r ioscip-go gomod github.com/golang/go/src go1.12 io/.Readerscip-go gomod github.com/golang/go/src go1.12 io/Reader#
108 // Expect
109 count int
110 }{
111 {
112 "From empty",
113 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{},
114 "test",
115 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
116 1,
117 },
118 {
119 "From one",
120 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Existing", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, ""}},
121 "test",
122 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
123 2,
124 },
125 }
126 for _, tt := range tests {
127 tt := tt
128 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
129 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
130
131 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
132 m.AttachInlinescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#AttachInline().(tt.pname, tt.r)
133
134 if tt.count != len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.) {
135 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Attach() len = %v, wantLen %v", tt.name, len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.), tt.count)
136 }
137 })
138 }
139 }
140
141 // TestMailYakAttachWithMimeType calls AttachWithMimeType() and ensures the attachment slice is the
142 // correct length
143 func TestMailYakAttachWithMimeTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakAttachWithMimeType().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
144 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
145
146 tests := []struct {
147 // Test description.
148 name string
149 // Receiver fields.
150 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
151 // Parameters.
152 pname string
153 r ioscip-go gomod github.com/golang/go/src go1.12 io/.Readerscip-go gomod github.com/golang/go/src go1.12 io/Reader#
154 mime string
155 // Expect
156 count int
157 }{
158 {
159 "From empty",
160 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{},
161 "test",
162 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
163 "text/csv; charset=utf-8",
164 1,
165 },
166 {
167 "From one",
168 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Existing", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, "text/csv; charset=utf-8"}},
169 "test",
170 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
171 "text/csv; charset=utf-8",
172 2,
173 },
174 }
175 for _, tt := range tests {
176 tt := tt
177 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
178 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
179
180 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
181 m.AttachWithMimeTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#AttachWithMimeType().(tt.pname, tt.r, tt.mime)
182
183 if tt.count != len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.) {
184 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Attach() len = %v, wantLen %v", tt.name, len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.), tt.count)
185 }
186 })
187 }
188 }
189
190 // TestMailYakAttachWithMimeType calls AttachInlineWithMimeType() and ensures the attachment slice is the
191 // correct length
192 func TestMailYakAttachInlineWithMimeTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakAttachInlineWithMimeType().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
193 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
194
195 tests := []struct {
196 // Test description.
197 name string
198 // Receiver fields.
199 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
200 // Parameters.
201 pname string
202 r ioscip-go gomod github.com/golang/go/src go1.12 io/.Readerscip-go gomod github.com/golang/go/src go1.12 io/Reader#
203 mime string
204 // Expect
205 count int
206 }{
207 {
208 "From empty",
209 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{},
210 "test",
211 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
212 "text/csv; charset=utf-8",
213 1,
214 },
215 {
216 "From one",
217 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Existing", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, "text/csv; charset=utf-8"}},
218 "test",
219 &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{},
220 "text/csv; charset=utf-8",
221 2,
222 },
223 }
224 for _, tt := range tests {
225 tt := tt
226 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
227 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
228
229 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
230 m.AttachInlineWithMimeTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#AttachInlineWithMimeType().(tt.pname, tt.r, tt.mime)
231
232 if tt.count != len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.) {
233 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Attach() len = %v, wantLen %v", tt.name, len(m.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.), tt.count)
234 }
235 })
236 }
237 }
238
239 // TestMailYakWriteAttachments ensures the correct headers are wrote, and the
240 // data is base64 encoded correctly
241 func TestMailYakWriteAttachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakWriteAttachments().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
242 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
243
244 tests := []struct {
245 // Test description.
246 name string
247 // Receiver fields.
248 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
249 // Expected results.
250 ctype string
251 disp string
252 data string
253 wantErr bool
254 }{
255 {
256 "Empty",
257 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Empty", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, ""}},
258 "text/plain; charset=utf-8;\n\tfilename=\"Empty\"; name=\"Empty\"",
259 "attachment;\n\tfilename=\"Empty\"; name=\"Empty\"",
260 "",
261 false,
262 },
263 {
264 "Short string",
265 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"advice", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("Don't Panic"), false, ""}},
266 "text/plain; charset=utf-8;\n\tfilename=\"advice\"; name=\"advice\"",
267 "attachment;\n\tfilename=\"advice\"; name=\"advice\"",
268 "RG9uJ3QgUGFuaWM=",
269 false,
270 },
271 {
272 "Space in filename",
273 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Empty with spaces", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, ""}},
274 "text/plain; charset=utf-8;\n\tfilename=\"Empty with spaces\"; name=\"Empty with spaces\"",
275 "attachment;\n\tfilename=\"Empty with spaces\"; name=\"Empty with spaces\"",
276 "",
277 false,
278 },
279 {
280 "With specified MIME type",
281 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Empty with spaces", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, false, "text/csv; charset=utf-8"}},
282 "text/csv; charset=utf-8;\n\tfilename=\"Empty with spaces\"; name=\"Empty with spaces\"",
283 "attachment;\n\tfilename=\"Empty with spaces\"; name=\"Empty with spaces\"",
284 "",
285 false,
286 },
287 {
288 "Longer string",
289 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
290 {
291 "partyinvite.txt",
292 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
293 "If Baldrick served a meal at HQ he would be arrested for the biggest " +
294 "mass poisoning since Lucretia Borgia invited 500 friends for a Wine and Anthrax Party.",
295 ),
296 false,
297 "",
298 },
299 },
300 "text/plain; charset=utf-8;\n\tfilename=\"partyinvite.txt\"; name=\"partyinvite.txt\"",
301 "attachment;\n\tfilename=\"partyinvite.txt\"; name=\"partyinvite.txt\"",
302 "SWYgQmFsZHJpY2sgc2VydmVkIGEgbWVhbCBhdCBIUSBoZSB3b3VsZCBiZSBhcnJlc3Rl" +
303 "ZCBmb3IgdGhlIGJpZ2dlc3QgbWFzcyBwb2lzb25pbmcgc2luY2UgTHVjcmV0aWEgQm9y" +
304 "Z2lhIGludml0ZWQgNTAwIGZyaWVuZHMgZm9yIGEgV2luZSBhbmQgQW50aHJheCBQYXJ0eS4=",
305 false,
306 },
307 {
308 "String >512 characters (content type sniff)",
309 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
310 {
311 "qed.txt",
312 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
313 `Now it is such a bizarrely improbable coincidence that anything so mind-bogglingly ` +
314 `useful could have evolved purely by chance that some thinkers have chosen to see it ` +
315 `as the final and clinching proof of the non-existence of God. The argument goes something ` +
316 `like this: "I refuse to prove that I exist," says God, "for proof denies faith, and ` +
317 `without faith I am nothing." "But," says Man, "The Babel fish is a dead giveaway, ` +
318 `isn't it? It could not have evolved by chance. It proves you exist, and so therefore, ` +
319 `by your own arguments, you don't. QED." "Oh dear," says God, "I hadn't thought of ` +
320 `that," and promptly vanishes in a puff of logic. "Oh, that was easy," says Man, and ` +
321 `for an encore goes on to prove that black is white and gets himself killed on the next ` +
322 `zebra crossing.`,
323 ),
324 false,
325 "",
326 },
327 },
328 "text/plain; charset=utf-8;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
329 "attachment;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
330 "Tm93IGl0IGlzIHN1Y2ggYSBiaXphcnJlbHkgaW1wcm9iYWJsZSBjb2luY2lkZW5jZSB0a" +
331 "GF0IGFueXRoaW5nIHNvIG1pbmQtYm9nZ2xpbmdseSB1c2VmdWwgY291bGQgaGF2ZSBldm" +
332 "9sdmVkIHB1cmVseSBieSBjaGFuY2UgdGhhdCBzb21lIHRoaW5rZXJzIGhhdmUgY2hvc2V" +
333 "uIHRvIHNlZSBpdCBhcyB0aGUgZmluYWwgYW5kIGNsaW5jaGluZyBwcm9vZiBvZiB0aGUg" +
334 "bm9uLWV4aXN0ZW5jZSBvZiBHb2QuIFRoZSBhcmd1bWVudCBnb2VzIHNvbWV0aGluZyBsa" +
335 "WtlIHRoaXM6ICJJIHJlZnVzZSB0byBwcm92ZSB0aGF0IEkgZXhpc3QsIiBzYXlzIEdvZC" +
336 "wgImZvciBwcm9vZiBkZW5pZXMgZmFpdGgsIGFuZCB3aXRob3V0IGZhaXRoIEkgYW0gbm9" +
337 "0aGluZy4iICJCdXQsIiBzYXlzIE1hbiwgIlRoZSBCYWJlbCBmaXNoIGlzIGEgZGVhZCBn" +
338 "aXZlYXdheSwgaXNuJ3QgaXQ/IEl0IGNvdWxkIG5vdCBoYXZlIGV2b2x2ZWQgYnkgY2hhb" +
339 "mNlLiBJdCBwcm92ZXMgeW91IGV4aXN0LCBhbmQgc28gdGhlcmVmb3JlLCBieSB5b3VyIG" +
340 "93biBhcmd1bWVudHMsIHlvdSBkb24ndC4gUUVELiIgIk9oIGRlYXIsIiBzYXlzIEdvZCw" +
341 "gIkkgaGFkbid0IHRob3VnaHQgb2YgdGhhdCwiIGFuZCBwcm9tcHRseSB2YW5pc2hlcyBp" +
342 "biBhIHB1ZmYgb2YgbG9naWMuICJPaCwgdGhhdCB3YXMgZWFzeSwiIHNheXMgTWFuLCBhb" +
343 "mQgZm9yIGFuIGVuY29yZSBnb2VzIG9uIHRvIHByb3ZlIHRoYXQgYmxhY2sgaXMgd2hpdG" +
344 "UgYW5kIGdldHMgaGltc2VsZiBraWxsZWQgb24gdGhlIG5leHQgemVicmEgY3Jvc3Npbmcu",
345 false,
346 },
347 {
348 "HTML",
349 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.html", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), false, ""}},
350 "text/html; charset=utf-8;\n\tfilename=\"name.html\"; name=\"name.html\"",
351 "attachment;\n\tfilename=\"name.html\"; name=\"name.html\"",
352 "PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4=",
353 false,
354 },
355 {
356 "HTML - wrong extension",
357 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.png", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), false, ""}},
358 "text/html; charset=utf-8;\n\tfilename=\"name.png\"; name=\"name.png\"",
359 "attachment;\n\tfilename=\"name.png\"; name=\"name.png\"",
360 "PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4=",
361 false,
362 },
363
364 // inline attachments
365 {
366 "Empty inline",
367 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"Empty", &bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#{}, true, ""}},
368 "text/plain; charset=utf-8;\n\tfilename=\"Empty\"; name=\"Empty\"",
369 "inline;\n\tfilename=\"Empty\"; name=\"Empty\"",
370 "",
371 false,
372 },
373 {
374 "Short string inline",
375 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"advice", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("Don't Panic"), true, ""}},
376 "text/plain; charset=utf-8;\n\tfilename=\"advice\"; name=\"advice\"",
377 "inline;\n\tfilename=\"advice\"; name=\"advice\"",
378 "RG9uJ3QgUGFuaWM=",
379 false,
380 },
381 {
382 "Longer string inline",
383 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
384 {
385 "partyinvite.txt",
386 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
387 "If Baldrick served a meal at HQ he would be arrested for the biggest " +
388 "mass poisoning since Lucretia Borgia invited 500 friends for a Wine and Anthrax Party.",
389 ),
390 true,
391 "",
392 },
393 },
394 "text/plain; charset=utf-8;\n\tfilename=\"partyinvite.txt\"; name=\"partyinvite.txt\"",
395 "inline;\n\tfilename=\"partyinvite.txt\"; name=\"partyinvite.txt\"",
396 "SWYgQmFsZHJpY2sgc2VydmVkIGEgbWVhbCBhdCBIUSBoZSB3b3VsZCBiZSBhcnJlc3Rl" +
397 "ZCBmb3IgdGhlIGJpZ2dlc3QgbWFzcyBwb2lzb25pbmcgc2luY2UgTHVjcmV0aWEgQm9y" +
398 "Z2lhIGludml0ZWQgNTAwIGZyaWVuZHMgZm9yIGEgV2luZSBhbmQgQW50aHJheCBQYXJ0eS4=",
399 false,
400 },
401 {
402 "String >512 characters (content type sniff) inline",
403 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
404 {
405 "qed.txt",
406 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
407 `Now it is such a bizarrely improbable coincidence that anything so mind-bogglingly ` +
408 `useful could have evolved purely by chance that some thinkers have chosen to see it ` +
409 `as the final and clinching proof of the non-existence of God. The argument goes something ` +
410 `like this: "I refuse to prove that I exist," says God, "for proof denies faith, and ` +
411 `without faith I am nothing." "But," says Man, "The Babel fish is a dead giveaway, ` +
412 `isn't it? It could not have evolved by chance. It proves you exist, and so therefore, ` +
413 `by your own arguments, you don't. QED." "Oh dear," says God, "I hadn't thought of ` +
414 `that," and promptly vanishes in a puff of logic. "Oh, that was easy," says Man, and ` +
415 `for an encore goes on to prove that black is white and gets himself killed on the next ` +
416 `zebra crossing.`,
417 ),
418 true,
419 "",
420 },
421 },
422 "text/plain; charset=utf-8;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
423 "inline;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
424 "Tm93IGl0IGlzIHN1Y2ggYSBiaXphcnJlbHkgaW1wcm9iYWJsZSBjb2luY2lkZW5jZSB0a" +
425 "GF0IGFueXRoaW5nIHNvIG1pbmQtYm9nZ2xpbmdseSB1c2VmdWwgY291bGQgaGF2ZSBldm" +
426 "9sdmVkIHB1cmVseSBieSBjaGFuY2UgdGhhdCBzb21lIHRoaW5rZXJzIGhhdmUgY2hvc2V" +
427 "uIHRvIHNlZSBpdCBhcyB0aGUgZmluYWwgYW5kIGNsaW5jaGluZyBwcm9vZiBvZiB0aGUg" +
428 "bm9uLWV4aXN0ZW5jZSBvZiBHb2QuIFRoZSBhcmd1bWVudCBnb2VzIHNvbWV0aGluZyBsa" +
429 "WtlIHRoaXM6ICJJIHJlZnVzZSB0byBwcm92ZSB0aGF0IEkgZXhpc3QsIiBzYXlzIEdvZC" +
430 "wgImZvciBwcm9vZiBkZW5pZXMgZmFpdGgsIGFuZCB3aXRob3V0IGZhaXRoIEkgYW0gbm9" +
431 "0aGluZy4iICJCdXQsIiBzYXlzIE1hbiwgIlRoZSBCYWJlbCBmaXNoIGlzIGEgZGVhZCBn" +
432 "aXZlYXdheSwgaXNuJ3QgaXQ/IEl0IGNvdWxkIG5vdCBoYXZlIGV2b2x2ZWQgYnkgY2hhb" +
433 "mNlLiBJdCBwcm92ZXMgeW91IGV4aXN0LCBhbmQgc28gdGhlcmVmb3JlLCBieSB5b3VyIG" +
434 "93biBhcmd1bWVudHMsIHlvdSBkb24ndC4gUUVELiIgIk9oIGRlYXIsIiBzYXlzIEdvZCw" +
435 "gIkkgaGFkbid0IHRob3VnaHQgb2YgdGhhdCwiIGFuZCBwcm9tcHRseSB2YW5pc2hlcyBp" +
436 "biBhIHB1ZmYgb2YgbG9naWMuICJPaCwgdGhhdCB3YXMgZWFzeSwiIHNheXMgTWFuLCBhb" +
437 "mQgZm9yIGFuIGVuY29yZSBnb2VzIG9uIHRvIHByb3ZlIHRoYXQgYmxhY2sgaXMgd2hpdG" +
438 "UgYW5kIGdldHMgaGltc2VsZiBraWxsZWQgb24gdGhlIG5leHQgemVicmEgY3Jvc3Npbmcu",
439 false,
440 },
441 {
442 "HTML inline",
443 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.html", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), true, ""}},
444 "text/html; charset=utf-8;\n\tfilename=\"name.html\"; name=\"name.html\"",
445 "inline;\n\tfilename=\"name.html\"; name=\"name.html\"",
446 "PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4=",
447 false,
448 },
449 {
450 "HTML - wrong extension inline",
451 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.png", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), true, ""}},
452 "text/html; charset=utf-8;\n\tfilename=\"name.png\"; name=\"name.png\"",
453 "inline;\n\tfilename=\"name.png\"; name=\"name.png\"",
454 "PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4=",
455 false,
456 },
457 {
458 "String >512 characters (read full buffer)",
459 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
460 {
461 "qed.txt",
462 base64scip-go gomod github.com/golang/go/src go1.12 `encoding/base64`/.NewDecoderscip-go gomod github.com/golang/go/src go1.12 `encoding/base64`/NewDecoder().(base64scip-go gomod github.com/golang/go/src go1.12 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.12 `encoding/base64`/StdEncoding., stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
463 "Tm93IGl0IGlzIHN1Y2ggYSBiaXphcnJlbHkgaW1wcm9iYWJsZSBjb2luY2lkZW5jZSB0a"+
464 "GF0IGFueXRoaW5nIHNvIG1pbmQtYm9nZ2xpbmdseSB1c2VmdWwgY291bGQgaGF2ZSBldm"+
465 "9sdmVkIHB1cmVseSBieSBjaGFuY2UgdGhhdCBzb21lIHRoaW5rZXJzIGhhdmUgY2hvc2V"+
466 "uIHRvIHNlZSBpdCBhcyB0aGUgZmluYWwgYW5kIGNsaW5jaGluZyBwcm9vZiBvZiB0aGUg"+
467 "bm9uLWV4aXN0ZW5jZSBvZiBHb2QuIFRoZSBhcmd1bWVudCBnb2VzIHNvbWV0aGluZyBsa"+
468 "WtlIHRoaXM6ICJJIHJlZnVzZSB0byBwcm92ZSB0aGF0IEkgZXhpc3QsIiBzYXlzIEdvZC"+
469 "wgImZvciBwcm9vZiBkZW5pZXMgZmFpdGgsIGFuZCB3aXRob3V0IGZhaXRoIEkgYW0gbm9"+
470 "0aGluZy4iICJCdXQsIiBzYXlzIE1hbiwgIlRoZSBCYWJlbCBmaXNoIGlzIGEgZGVhZCBn"+
471 "aXZlYXdheSwgaXNuJ3QgaXQ/IEl0IGNvdWxkIG5vdCBoYXZlIGV2b2x2ZWQgYnkgY2hhb"+
472 "mNlLiBJdCBwcm92ZXMgeW91IGV4aXN0LCBhbmQgc28gdGhlcmVmb3JlLCBieSB5b3VyIG"+
473 "93biBhcmd1bWVudHMsIHlvdSBkb24ndC4gUUVELiIgIk9oIGRlYXIsIiBzYXlzIEdvZCw"+
474 "gIkkgaGFkbid0IHRob3VnaHQgb2YgdGhhdCwiIGFuZCBwcm9tcHRseSB2YW5pc2hlcyBp"+
475 "biBhIHB1ZmYgb2YgbG9naWMuICJPaCwgdGhhdCB3YXMgZWFzeSwiIHNheXMgTWFuLCBhb"+
476 "mQgZm9yIGFuIGVuY29yZSBnb2VzIG9uIHRvIHByb3ZlIHRoYXQgYmxhY2sgaXMgd2hpdG"+
477 "UgYW5kIGdldHMgaGltc2VsZiBraWxsZWQgb24gdGhlIG5leHQgemVicmEgY3Jvc3Npbmcu",
478 )),
479 false,
480 "",
481 },
482 },
483 "text/plain; charset=utf-8;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
484 "attachment;\n\tfilename=\"qed.txt\"; name=\"qed.txt\"",
485 "Tm93IGl0IGlzIHN1Y2ggYSBiaXphcnJlbHkgaW1wcm9iYWJsZSBjb2luY2lkZW5jZSB0a" +
486 "GF0IGFueXRoaW5nIHNvIG1pbmQtYm9nZ2xpbmdseSB1c2VmdWwgY291bGQgaGF2ZSBldm" +
487 "9sdmVkIHB1cmVseSBieSBjaGFuY2UgdGhhdCBzb21lIHRoaW5rZXJzIGhhdmUgY2hvc2V" +
488 "uIHRvIHNlZSBpdCBhcyB0aGUgZmluYWwgYW5kIGNsaW5jaGluZyBwcm9vZiBvZiB0aGUg" +
489 "bm9uLWV4aXN0ZW5jZSBvZiBHb2QuIFRoZSBhcmd1bWVudCBnb2VzIHNvbWV0aGluZyBsa" +
490 "WtlIHRoaXM6ICJJIHJlZnVzZSB0byBwcm92ZSB0aGF0IEkgZXhpc3QsIiBzYXlzIEdvZC" +
491 "wgImZvciBwcm9vZiBkZW5pZXMgZmFpdGgsIGFuZCB3aXRob3V0IGZhaXRoIEkgYW0gbm9" +
492 "0aGluZy4iICJCdXQsIiBzYXlzIE1hbiwgIlRoZSBCYWJlbCBmaXNoIGlzIGEgZGVhZCBn" +
493 "aXZlYXdheSwgaXNuJ3QgaXQ/IEl0IGNvdWxkIG5vdCBoYXZlIGV2b2x2ZWQgYnkgY2hhb" +
494 "mNlLiBJdCBwcm92ZXMgeW91IGV4aXN0LCBhbmQgc28gdGhlcmVmb3JlLCBieSB5b3VyIG" +
495 "93biBhcmd1bWVudHMsIHlvdSBkb24ndC4gUUVELiIgIk9oIGRlYXIsIiBzYXlzIEdvZCw" +
496 "gIkkgaGFkbid0IHRob3VnaHQgb2YgdGhhdCwiIGFuZCBwcm9tcHRseSB2YW5pc2hlcyBp" +
497 "biBhIHB1ZmYgb2YgbG9naWMuICJPaCwgdGhhdCB3YXMgZWFzeSwiIHNheXMgTWFuLCBhb" +
498 "mQgZm9yIGFuIGVuY29yZSBnb2VzIG9uIHRvIHByb3ZlIHRoYXQgYmxhY2sgaXMgd2hpdG" +
499 "UgYW5kIGdldHMgaGltc2VsZiBraWxsZWQgb24gdGhlIG5leHQgemVicmEgY3Jvc3Npbmcu",
500 false,
501 },
502 }
503 for _, tt := range tests {
504 tt := tt
505 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
506 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
507
508 m := MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
509 pc := testPartCreatorscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#{}
510
511 if err := m.writeAttachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#writeAttachments().(&pc, nopBuilderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopBuilder#{}); (err != nil) != tt.wantErr {
512 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() error = %v, wantErr %v", tt.name, err, tt.wantErr)
513 }
514
515 // Ensure there's an attachment
516 if len(pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.) != 1 {
517 t.Fatalfscip-go gomod github.com/golang/go/src go1.12 testing/common#Fatalf().("%q. MailYak.writeAttachments() unexpected number of attachments = %v, want 1", tt.name, len(pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.))
518 }
519
520 if pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType. != tt.ctype {
521 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() content type = %v, want %v", tt.name, pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType., tt.ctype)
522 }
523
524 if pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition. != tt.disp {
525 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() disposition = %v, want %v", tt.name, pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition., tt.disp)
526 }
527
528 if pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().() != tt.data {
529 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() data = %v, want %v", tt.name, pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[0].datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), tt.data)
530 }
531 })
532 }
533 }
534
535 // TestMailYakWriteAttachments_multipleAttachments ensures multiple attachments
536 // are correctly handled
537 func TestMailYakWriteAttachments_multipleAttachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakWriteAttachments_multipleAttachments().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
538 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
539
540 tests := []struct {
541 // Test description.
542 name string
543 // Receiver fields.
544 rattachments []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#
545 // Expected results.
546 want []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#
547 wantErr bool
548 }{
549 {
550 "Single Attachment",
551 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, ""}},
552 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
553 {
554 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
555 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
556 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
557 },
558 },
559 false,
560 },
561 {
562 "Single Attachment with specified MIME type",
563 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, "text/csv; charset=utf-8"}},
564 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
565 {
566 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/csv; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
567 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
568 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
569 },
570 },
571 false,
572 },
573 {
574 "Multiple Attachment - same types",
575 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
576 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, ""},
577 {"different.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("another"), false, ""},
578 },
579 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
580 {
581 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
582 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
583 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
584 },
585 {
586 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
587 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
588 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("YW5vdGhlcg=="),
589 },
590 },
591 false,
592 },
593 {
594 "Multiple Attachment - different types",
595 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
596 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, ""},
597 {"html.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), false, ""},
598 },
599 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
600 {
601 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
602 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
603 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
604 },
605 {
606 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/html; charset=utf-8;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
607 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
608 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4="),
609 },
610 },
611 false,
612 },
613 {
614 "Multiple Attachment - different specified MIME types",
615 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
616 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, "text/csv; charset=utf-8"},
617 {"html.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), false, "application/xml"},
618 },
619 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
620 {
621 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/csv; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
622 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
623 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
624 },
625 {
626 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "application/xml;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
627 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
628 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4="),
629 },
630 },
631 false,
632 },
633 {
634 "Multiple Attachments - >512 bytes, longer first",
635 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
636 {
637 "550.txt",
638 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
639 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ut nisl felis. " +
640 "Aenean felis justo, gravida eget leo aliquet, molestie aliquam risus. Vestibulum " +
641 "et nibh rhoncus, malesuada tellus eget, pellentesque diam. Sed venenatis vitae " +
642 "erat vel ullamcorper. Aenean rutrum pulvinar purus eget cursus. Integer at iaculis " +
643 "arcu. Maecenas mollis nulla dolor, et ultricies massa posuere quis. Nulla facilisi. " +
644 "Proin luctus nec nisl at imperdiet. Nulla dapibus purus ut lorem faucibus, at gravida " +
645 "tellus euismod. Curabitur ex risus, egestas in porta amet.",
646 ),
647 false,
648 "",
649 },
650 {
651 "520.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
652 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu vestibulum dolor. " +
653 "Nunc ac posuere felis, a mattis leo. Duis elementum tempor leo, sed efficitur nunc. " +
654 "Cras ornare feugiat vulputate. Maecenas sit amet felis lobortis ipsum dignissim euismod. " +
655 "Vestibulum id ullamcorper nulla, tincidunt hendrerit justo. Donec vitae eros quam. Nulla " +
656 "accumsan porta sapien, in consequat mauris fermentum ac. In at sem lobortis, auctor metus " +
657 "rutrum, blandit ipsum. Praesent commodo porta semper. Etiam dignissim libero nullam.",
658 ),
659 false,
660 "",
661 },
662 },
663 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
664 {
665 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
666 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
667 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
668 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTWF1cmlzIHV0IG5pc" +
669 "2wgZmVsaXMuIEFlbmVhbiBmZWxpcyBqdXN0bywgZ3JhdmlkYSBlZ2V0IGxlbyBhbGlxdWV0LCBtb2xlc3RpZSBhbGlxdW" +
670 "FtIHJpc3VzLiBWZXN0aWJ1bHVtIGV0IG5pYmggcmhvbmN1cywgbWFsZXN1YWRhIHRlbGx1cyBlZ2V0LCBwZWxsZW50ZXN" +
671 "xdWUgZGlhbS4gU2VkIHZlbmVuYXRpcyB2aXRhZSBlcmF0IHZlbCB1bGxhbWNvcnBlci4gQWVuZWFuIHJ1dHJ1bSBwdWx2" +
672 "aW5hciBwdXJ1cyBlZ2V0IGN1cnN1cy4gSW50ZWdlciBhdCBpYWN1bGlzIGFyY3UuIE1hZWNlbmFzIG1vbGxpcyBudWxsY" +
673 "SBkb2xvciwgZXQgdWx0cmljaWVzIG1hc3NhIHBvc3VlcmUgcXVpcy4gTnVsbGEgZmFjaWxpc2kuIFByb2luIGx1Y3R1cy" +
674 "BuZWMgbmlzbCBhdCBpbXBlcmRpZXQuIE51bGxhIGRhcGlidXMgcHVydXMgdXQgbG9yZW0gZmF1Y2lidXMsIGF0IGdyYXZ" +
675 "pZGEgdGVsbHVzIGV1aXNtb2QuIEN1cmFiaXR1ciBleCByaXN1cywgZWdlc3RhcyBpbiBwb3J0YSBhbWV0Lg==",
676 ),
677 },
678 {
679 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
680 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
681 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
682 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gRG9uZWMgZXUgdmVz" +
683 "dGlidWx1bSBkb2xvci4gTnVuYyBhYyBwb3N1ZXJlIGZlbGlzLCBhIG1hdHRpcyBsZW8uIER1aXMgZWxlbWVudHVtIHRl" +
684 "bXBvciBsZW8sIHNlZCBlZmZpY2l0dXIgbnVuYy4gQ3JhcyBvcm5hcmUgZmV1Z2lhdCB2dWxwdXRhdGUuIE1hZWNlbmFz" +
685 "IHNpdCBhbWV0IGZlbGlzIGxvYm9ydGlzIGlwc3VtIGRpZ25pc3NpbSBldWlzbW9kLiBWZXN0aWJ1bHVtIGlkIHVsbGFt" +
686 "Y29ycGVyIG51bGxhLCB0aW5jaWR1bnQgaGVuZHJlcml0IGp1c3RvLiBEb25lYyB2aXRhZSBlcm9zIHF1YW0uIE51bGxh" +
687 "IGFjY3Vtc2FuIHBvcnRhIHNhcGllbiwgaW4gY29uc2VxdWF0IG1hdXJpcyBmZXJtZW50dW0gYWMuIEluIGF0IHNlbSBs" +
688 "b2JvcnRpcywgYXVjdG9yIG1ldHVzIHJ1dHJ1bSwgYmxhbmRpdCBpcHN1bS4gUHJhZXNlbnQgY29tbW9kbyBwb3J0YSBz" +
689 "ZW1wZXIuIEV0aWFtIGRpZ25pc3NpbSBsaWJlcm8gbnVsbGFtLg==",
690 ),
691 },
692 },
693 false,
694 },
695 {
696 "Multiple Attachments - >512 bytes, shorter first",
697 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
698 {
699 "520.txt",
700 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
701 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu vestibulum dolor. Nunc ac " +
702 "posuere felis, a mattis leo. Duis elementum tempor leo, sed efficitur nunc. Cras ornare " +
703 "feugiat vulputate. Maecenas sit amet felis lobortis ipsum dignissim euismod. Vestibulum " +
704 "id ullamcorper nulla, tincidunt hendrerit justo. Donec vitae eros quam. Nulla accumsan " +
705 "porta sapien, in consequat mauris fermentum ac. In at sem lobortis, auctor metus rutrum, " +
706 "blandit ipsum. Praesent commodo porta semper. Etiam dignissim libero nullam.",
707 ),
708 false,
709 "",
710 },
711 {
712 "550.txt",
713 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
714 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ut nisl felis. Aenean felis " +
715 "justo, gravida eget leo aliquet, molestie aliquam risus. Vestibulum et nibh rhoncus, " +
716 "malesuada tellus eget, pellentesque diam. Sed venenatis vitae erat vel ullamcorper. " +
717 "Aenean rutrum pulvinar purus eget cursus. Integer at iaculis arcu. Maecenas mollis " +
718 "nulla dolor, et ultricies massa posuere quis. Nulla facilisi. Proin luctus nec nisl " +
719 "at imperdiet. Nulla dapibus purus ut lorem faucibus, at gravida tellus euismod. Curabitur " +
720 "ex risus, egestas in porta amet.",
721 ),
722 false,
723 "",
724 },
725 },
726 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
727 {
728 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
729 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
730 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
731 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gRG9uZWMgZXUgdmVz" +
732 "dGlidWx1bSBkb2xvci4gTnVuYyBhYyBwb3N1ZXJlIGZlbGlzLCBhIG1hdHRpcyBsZW8uIER1aXMgZWxlbWVudHVtIHRl" +
733 "bXBvciBsZW8sIHNlZCBlZmZpY2l0dXIgbnVuYy4gQ3JhcyBvcm5hcmUgZmV1Z2lhdCB2dWxwdXRhdGUuIE1hZWNlbmFz" +
734 "IHNpdCBhbWV0IGZlbGlzIGxvYm9ydGlzIGlwc3VtIGRpZ25pc3NpbSBldWlzbW9kLiBWZXN0aWJ1bHVtIGlkIHVsbGFt" +
735 "Y29ycGVyIG51bGxhLCB0aW5jaWR1bnQgaGVuZHJlcml0IGp1c3RvLiBEb25lYyB2aXRhZSBlcm9zIHF1YW0uIE51bGxh" +
736 "IGFjY3Vtc2FuIHBvcnRhIHNhcGllbiwgaW4gY29uc2VxdWF0IG1hdXJpcyBmZXJtZW50dW0gYWMuIEluIGF0IHNlbSBs" +
737 "b2JvcnRpcywgYXVjdG9yIG1ldHVzIHJ1dHJ1bSwgYmxhbmRpdCBpcHN1bS4gUHJhZXNlbnQgY29tbW9kbyBwb3J0YSBz" +
738 "ZW1wZXIuIEV0aWFtIGRpZ25pc3NpbSBsaWJlcm8gbnVsbGFtLg==",
739 ),
740 },
741 {
742 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
743 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
744 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
745 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTWF1cmlzIHV0IG5p" +
746 "c2wgZmVsaXMuIEFlbmVhbiBmZWxpcyBqdXN0bywgZ3JhdmlkYSBlZ2V0IGxlbyBhbGlxdWV0LCBtb2xlc3RpZSBhbGlx" +
747 "dWFtIHJpc3VzLiBWZXN0aWJ1bHVtIGV0IG5pYmggcmhvbmN1cywgbWFsZXN1YWRhIHRlbGx1cyBlZ2V0LCBwZWxsZW50" +
748 "ZXNxdWUgZGlhbS4gU2VkIHZlbmVuYXRpcyB2aXRhZSBlcmF0IHZlbCB1bGxhbWNvcnBlci4gQWVuZWFuIHJ1dHJ1bSBw" +
749 "dWx2aW5hciBwdXJ1cyBlZ2V0IGN1cnN1cy4gSW50ZWdlciBhdCBpYWN1bGlzIGFyY3UuIE1hZWNlbmFzIG1vbGxpcyBu" +
750 "dWxsYSBkb2xvciwgZXQgdWx0cmljaWVzIG1hc3NhIHBvc3VlcmUgcXVpcy4gTnVsbGEgZmFjaWxpc2kuIFByb2luIGx1" +
751 "Y3R1cyBuZWMgbmlzbCBhdCBpbXBlcmRpZXQuIE51bGxhIGRhcGlidXMgcHVydXMgdXQgbG9yZW0gZmF1Y2lidXMsIGF0" +
752 "IGdyYXZpZGEgdGVsbHVzIGV1aXNtb2QuIEN1cmFiaXR1ciBleCByaXN1cywgZWdlc3RhcyBpbiBwb3J0YSBhbWV0Lg==",
753 ),
754 },
755 },
756 false,
757 },
758
759 // inline attachments
760 {
761 "Single Inline Attachment",
762 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), true, ""}},
763 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
764 {
765 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
766 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
767 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
768 },
769 },
770 false,
771 },
772 {
773 "Single Inline Attachment with specified MIME type",
774 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{{"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), true, "text/csv; charset=utf-8"}},
775 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
776 {
777 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/csv; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
778 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
779 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
780 },
781 },
782 false,
783 },
784 {
785 "Multiple Inline Attachments - same types",
786 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
787 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), true, ""},
788 {"different.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("another"), true, ""},
789 },
790 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
791 {
792 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
793 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
794 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
795 },
796 {
797 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
798 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
799 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("YW5vdGhlcg=="),
800 },
801 },
802 false,
803 },
804 {
805 "Multiple Attachments - One Inline, One not",
806 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
807 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), false, ""},
808 {"different.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("another"), true, ""},
809 },
810 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
811 {
812 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
813 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "attachment;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
814 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
815 },
816 {
817 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
818 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
819 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("YW5vdGhlcg=="),
820 },
821 },
822 false,
823 },
824 {
825 "Multiple Inline Attachments - different types",
826 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
827 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), true, ""},
828 {"html.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), true, ""},
829 },
830 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
831 {
832 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
833 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
834 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
835 },
836 {
837 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/html; charset=utf-8;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
838 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"html.txt\"; name=\"html.txt\"",
839 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4="),
840 },
841 },
842 false,
843 },
844 {
845 "Multiple Inline Attachments - specified MIME types",
846 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
847 {"name.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("test"), true, "text/csv; charset=utf-8"},
848 {"different.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().("<html><head></head></html>"), true, "application/xml"},
849 },
850 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
851 {
852 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/csv; charset=utf-8;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
853 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"name.txt\"; name=\"name.txt\"",
854 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("dGVzdA=="),
855 },
856 {
857 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "application/xml;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
858 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"different.txt\"; name=\"different.txt\"",
859 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().("PGh0bWw+PGhlYWQ+PC9oZWFkPjwvaHRtbD4="),
860 },
861 },
862 false,
863 },
864 {
865 "Multiple Inline Attachments - >512 bytes, longer first",
866 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
867 {
868 "550.txt",
869 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
870 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ut nisl felis. " +
871 "Aenean felis justo, gravida eget leo aliquet, molestie aliquam risus. Vestibulum " +
872 "et nibh rhoncus, malesuada tellus eget, pellentesque diam. Sed venenatis vitae " +
873 "erat vel ullamcorper. Aenean rutrum pulvinar purus eget cursus. Integer at iaculis " +
874 "arcu. Maecenas mollis nulla dolor, et ultricies massa posuere quis. Nulla facilisi. " +
875 "Proin luctus nec nisl at imperdiet. Nulla dapibus purus ut lorem faucibus, at gravida " +
876 "tellus euismod. Curabitur ex risus, egestas in porta amet.",
877 ),
878 true,
879 "",
880 },
881 {
882 "520.txt", stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
883 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu vestibulum dolor. " +
884 "Nunc ac posuere felis, a mattis leo. Duis elementum tempor leo, sed efficitur nunc. " +
885 "Cras ornare feugiat vulputate. Maecenas sit amet felis lobortis ipsum dignissim euismod. " +
886 "Vestibulum id ullamcorper nulla, tincidunt hendrerit justo. Donec vitae eros quam. Nulla " +
887 "accumsan porta sapien, in consequat mauris fermentum ac. In at sem lobortis, auctor metus " +
888 "rutrum, blandit ipsum. Praesent commodo porta semper. Etiam dignissim libero nullam.",
889 ),
890 true,
891 "",
892 },
893 },
894 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
895 {
896 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
897 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
898 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
899 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTWF1cmlzIHV0IG5pc" +
900 "2wgZmVsaXMuIEFlbmVhbiBmZWxpcyBqdXN0bywgZ3JhdmlkYSBlZ2V0IGxlbyBhbGlxdWV0LCBtb2xlc3RpZSBhbGlxdW" +
901 "FtIHJpc3VzLiBWZXN0aWJ1bHVtIGV0IG5pYmggcmhvbmN1cywgbWFsZXN1YWRhIHRlbGx1cyBlZ2V0LCBwZWxsZW50ZXN" +
902 "xdWUgZGlhbS4gU2VkIHZlbmVuYXRpcyB2aXRhZSBlcmF0IHZlbCB1bGxhbWNvcnBlci4gQWVuZWFuIHJ1dHJ1bSBwdWx2" +
903 "aW5hciBwdXJ1cyBlZ2V0IGN1cnN1cy4gSW50ZWdlciBhdCBpYWN1bGlzIGFyY3UuIE1hZWNlbmFzIG1vbGxpcyBudWxsY" +
904 "SBkb2xvciwgZXQgdWx0cmljaWVzIG1hc3NhIHBvc3VlcmUgcXVpcy4gTnVsbGEgZmFjaWxpc2kuIFByb2luIGx1Y3R1cy" +
905 "BuZWMgbmlzbCBhdCBpbXBlcmRpZXQuIE51bGxhIGRhcGlidXMgcHVydXMgdXQgbG9yZW0gZmF1Y2lidXMsIGF0IGdyYXZ" +
906 "pZGEgdGVsbHVzIGV1aXNtb2QuIEN1cmFiaXR1ciBleCByaXN1cywgZWdlc3RhcyBpbiBwb3J0YSBhbWV0Lg==",
907 ),
908 },
909 {
910 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
911 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
912 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
913 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gRG9uZWMgZXUgdmVz" +
914 "dGlidWx1bSBkb2xvci4gTnVuYyBhYyBwb3N1ZXJlIGZlbGlzLCBhIG1hdHRpcyBsZW8uIER1aXMgZWxlbWVudHVtIHRl" +
915 "bXBvciBsZW8sIHNlZCBlZmZpY2l0dXIgbnVuYy4gQ3JhcyBvcm5hcmUgZmV1Z2lhdCB2dWxwdXRhdGUuIE1hZWNlbmFz" +
916 "IHNpdCBhbWV0IGZlbGlzIGxvYm9ydGlzIGlwc3VtIGRpZ25pc3NpbSBldWlzbW9kLiBWZXN0aWJ1bHVtIGlkIHVsbGFt" +
917 "Y29ycGVyIG51bGxhLCB0aW5jaWR1bnQgaGVuZHJlcml0IGp1c3RvLiBEb25lYyB2aXRhZSBlcm9zIHF1YW0uIE51bGxh" +
918 "IGFjY3Vtc2FuIHBvcnRhIHNhcGllbiwgaW4gY29uc2VxdWF0IG1hdXJpcyBmZXJtZW50dW0gYWMuIEluIGF0IHNlbSBs" +
919 "b2JvcnRpcywgYXVjdG9yIG1ldHVzIHJ1dHJ1bSwgYmxhbmRpdCBpcHN1bS4gUHJhZXNlbnQgY29tbW9kbyBwb3J0YSBz" +
920 "ZW1wZXIuIEV0aWFtIGRpZ25pc3NpbSBsaWJlcm8gbnVsbGFtLg==",
921 ),
922 },
923 },
924 false,
925 },
926 {
927 "Multiple Inline Attachments - >512 bytes, shorter first",
928 []attachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/attachment#{
929 {
930 "520.txt",
931 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
932 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu vestibulum dolor. Nunc ac " +
933 "posuere felis, a mattis leo. Duis elementum tempor leo, sed efficitur nunc. Cras ornare " +
934 "feugiat vulputate. Maecenas sit amet felis lobortis ipsum dignissim euismod. Vestibulum " +
935 "id ullamcorper nulla, tincidunt hendrerit justo. Donec vitae eros quam. Nulla accumsan " +
936 "porta sapien, in consequat mauris fermentum ac. In at sem lobortis, auctor metus rutrum, " +
937 "blandit ipsum. Praesent commodo porta semper. Etiam dignissim libero nullam.",
938 ),
939 true,
940 "",
941 },
942 {
943 "550.txt",
944 stringsscip-go gomod github.com/golang/go/src go1.12 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.12 strings/NewReader().(
945 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ut nisl felis. Aenean felis " +
946 "justo, gravida eget leo aliquet, molestie aliquam risus. Vestibulum et nibh rhoncus, " +
947 "malesuada tellus eget, pellentesque diam. Sed venenatis vitae erat vel ullamcorper. " +
948 "Aenean rutrum pulvinar purus eget cursus. Integer at iaculis arcu. Maecenas mollis " +
949 "nulla dolor, et ultricies massa posuere quis. Nulla facilisi. Proin luctus nec nisl " +
950 "at imperdiet. Nulla dapibus purus ut lorem faucibus, at gravida tellus euismod. Curabitur " +
951 "ex risus, egestas in porta amet.",
952 ),
953 true,
954 "",
955 },
956 },
957 []testAttachmentscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#{
958 {
959 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
960 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"520.txt\"; name=\"520.txt\"",
961 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
962 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gRG9uZWMgZXUgdmVz" +
963 "dGlidWx1bSBkb2xvci4gTnVuYyBhYyBwb3N1ZXJlIGZlbGlzLCBhIG1hdHRpcyBsZW8uIER1aXMgZWxlbWVudHVtIHRl" +
964 "bXBvciBsZW8sIHNlZCBlZmZpY2l0dXIgbnVuYy4gQ3JhcyBvcm5hcmUgZmV1Z2lhdCB2dWxwdXRhdGUuIE1hZWNlbmFz" +
965 "IHNpdCBhbWV0IGZlbGlzIGxvYm9ydGlzIGlwc3VtIGRpZ25pc3NpbSBldWlzbW9kLiBWZXN0aWJ1bHVtIGlkIHVsbGFt" +
966 "Y29ycGVyIG51bGxhLCB0aW5jaWR1bnQgaGVuZHJlcml0IGp1c3RvLiBEb25lYyB2aXRhZSBlcm9zIHF1YW0uIE51bGxh" +
967 "IGFjY3Vtc2FuIHBvcnRhIHNhcGllbiwgaW4gY29uc2VxdWF0IG1hdXJpcyBmZXJtZW50dW0gYWMuIEluIGF0IHNlbSBs" +
968 "b2JvcnRpcywgYXVjdG9yIG1ldHVzIHJ1dHJ1bSwgYmxhbmRpdCBpcHN1bS4gUHJhZXNlbnQgY29tbW9kbyBwb3J0YSBz" +
969 "ZW1wZXIuIEV0aWFtIGRpZ25pc3NpbSBsaWJlcm8gbnVsbGFtLg==",
970 ),
971 },
972 {
973 contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.: "text/plain; charset=utf-8;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
974 dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.: "inline;\n\tfilename=\"550.txt\"; name=\"550.txt\"",
975 datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data.: *bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.NewBufferStringscip-go gomod github.com/golang/go/src go1.12 bytes/NewBufferString().(
976 "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gTWF1cmlzIHV0IG5p" +
977 "c2wgZmVsaXMuIEFlbmVhbiBmZWxpcyBqdXN0bywgZ3JhdmlkYSBlZ2V0IGxlbyBhbGlxdWV0LCBtb2xlc3RpZSBhbGlx" +
978 "dWFtIHJpc3VzLiBWZXN0aWJ1bHVtIGV0IG5pYmggcmhvbmN1cywgbWFsZXN1YWRhIHRlbGx1cyBlZ2V0LCBwZWxsZW50" +
979 "ZXNxdWUgZGlhbS4gU2VkIHZlbmVuYXRpcyB2aXRhZSBlcmF0IHZlbCB1bGxhbWNvcnBlci4gQWVuZWFuIHJ1dHJ1bSBw" +
980 "dWx2aW5hciBwdXJ1cyBlZ2V0IGN1cnN1cy4gSW50ZWdlciBhdCBpYWN1bGlzIGFyY3UuIE1hZWNlbmFzIG1vbGxpcyBu" +
981 "dWxsYSBkb2xvciwgZXQgdWx0cmljaWVzIG1hc3NhIHBvc3VlcmUgcXVpcy4gTnVsbGEgZmFjaWxpc2kuIFByb2luIGx1" +
982 "Y3R1cyBuZWMgbmlzbCBhdCBpbXBlcmRpZXQuIE51bGxhIGRhcGlidXMgcHVydXMgdXQgbG9yZW0gZmF1Y2lidXMsIGF0" +
983 "IGdyYXZpZGEgdGVsbHVzIGV1aXNtb2QuIEN1cmFiaXR1ciBleCByaXN1cywgZWdlc3RhcyBpbiBwb3J0YSBhbWV0Lg==",
984 ),
985 },
986 },
987 false,
988 },
989 }
990
991 for _, tt := range tests {
992 tt := tt
993 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
994 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
995
996 m := MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#attachments.: tt.rattachments}
997 pc := testPartCreatorscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#{}
998
999 if err := m.writeAttachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#writeAttachments().(&pc, nopBuilderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/nopBuilder#{}); (err != nil) != tt.wantErr {
1000 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() error = %v, wantErr %v", tt.name, err, tt.wantErr)
1001 }
1002
1003 // Did we get enough attachments?
1004 if len(tt.want) != len(pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.) {
1005 t.Fatalfscip-go gomod github.com/golang/go/src go1.12 testing/common#Fatalf().("%q. MailYak.writeAttachments() unexpected number of attachments = %v, want %v", tt.name, len(pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.), len(tt.want))
1006 }
1007
1008 for i, want := range tt.want {
1009 got := pc.attachmentsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testPartCreator#attachments.[i]
1010
1011 if want.contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType. != got.contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType. {
1012 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() content type = %v, want %v", tt.name, want.contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType., got.contentTypescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#contentType.)
1013 }
1014
1015 if want.dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition. != got.dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition. {
1016 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() disposition = %v, want %v", tt.name, want.dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition., got.dispositionscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#disposition.)
1017 }
1018
1019 if !bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Equalscip-go gomod github.com/golang/go/src go1.12 bytes/Equal().(want.datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Bytesscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#Bytes().(), got.datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Bytesscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#Bytes().()) {
1020 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.writeAttachments() data = %v, want %v", tt.name, want.datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), got.datascip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/testAttachment#data..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().())
1021 }
1022 }
1023 })
1024 }
1025 }