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

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: tests and words 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
« no previous file with comments | « service/mail/message_test.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 if t == nil {
23 return nil
24 }
25 ret := &TestMessage{Message: *t.Message.Copy()}
26 if len(t.MIMETypes) > 0 {
27 ret.MIMETypes = make([]string, len(t.MIMETypes))
28 copy(ret.MIMETypes, t.MIMETypes)
29 }
30 return ret
31 }
32
33 // Testable is the interface for mail service implementations which are able
34 // to be tested (like impl/memory).
35 type Testable interface {
36 // Sets the list of admin emails. By default, testing implementations sh ould
37 // use ["admin@example.com"].
38 SetAdminEmails(emails ...string)
39
40 // SentMessages returns a copy of all messages which were successfully s ent
41 // via the mail API.
42 SentMessages() []*TestMessage
43
44 // Reset clears the SentMessages queue.
45 Reset()
46 }
OLDNEW
« no previous file with comments | « service/mail/message_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698