Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: service/mail/testable.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: add tests Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« service/mail/message.go ('K') | « service/mail/message.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package mail
6
7 // TestMessage is the message struct which will be returned from SentMessages.
8 //
9 // It augments the Message struct by also including the derived MIMEType for any
10 // attachments.
11 type TestMessage struct {
12 Message
13
14 // MIMETypes is guaranteed to be the same length as the attachments in t he
15 // Message, and will be populated with the derived MIME types for the
16 // attachments.
17 MIMETypes []string
18 }
19
20 // Copy duplicates this TestMessage.
21 func (t *TestMessage) Copy() *TestMessage {
22 ret := &TestMessage{Message: *t.Message.Copy()}
23 if len(t.MIMETypes) > 0 {
24 ret.MIMETypes = make([]string, len(t.MIMETypes))
25 copy(ret.MIMETypes, t.MIMETypes)
26 }
27 return ret
28 }
29
30 // Testable is the interface for mail service implementations which are able
31 // to be tested (like impl/memory).
32 type Testable interface {
33 // Sets the list of admin emails. By default, testing implementations sh ould
34 // use ["admin@example.com"].
35 SetAdminEmails(emails ...string)
36
37 // SentMessages returns a copy of all messages which were successfully s ent
38 // via the mail API.
39 SentMessages() []*TestMessage
40
41 // Reset clears the SentMessages queue.
42 Reset()
43 }
OLDNEW
« service/mail/message.go ('K') | « service/mail/message.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698