aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/util_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-22 12:53:31 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-22 13:08:34 +0100
commit7daaa06d53f0f496aa1a87656d16c81ebff37f73 (patch)
tree6648bf4e9b95724e61010fa9e3294e341773f4af /dashboard/app/util_test.go
parent04cbdbd1ae105f4d9f11fda99b588168cec2b3a8 (diff)
dashboard/app: restrict patch testing result CC list
Currently dashboard sends patch testing result to full bug CC list (which includes kernel mailing lists). This is unnecessary and causes problems with patchwork. Reply only to people in the testing request CC list (adding our mailing list if it was missing). Fixes #526
Diffstat (limited to 'dashboard/app/util_test.go')
-rw-r--r--dashboard/app/util_test.go36
1 files changed, 20 insertions, 16 deletions
diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go
index 8499b610f..17a8b460e 100644
--- a/dashboard/app/util_test.go
+++ b/dashboard/app/util_test.go
@@ -281,33 +281,37 @@ func (client *apiClient) updateBug(extID string, status dashapi.BugStatus, dup s
return reply
}
-func (c *Ctx) incomingEmail(to, body string) {
- c.incomingEmailImpl(0, "", to, body)
-}
-
-func (c *Ctx) incomingEmailFrom(from, to, body string) {
- c.incomingEmailImpl(0, from, to, body)
-}
-
-func (c *Ctx) incomingEmailID(id int, to, body string) {
- c.incomingEmailImpl(id, "", to, body)
-}
+type (
+ EmailOptMessageID int
+ EmailOptFrom string
+ EmailOptCC []string
+)
-func (c *Ctx) incomingEmailImpl(id int, from, to, body string) {
- if from == "" {
- from = "default@sender.com"
+func (c *Ctx) incomingEmail(to, body string, opts ...interface{}) {
+ id := 0
+ from := "default@sender.com"
+ cc := []string{"test@syzkaller.com", "bugs@syzkaller.com"}
+ for _, o := range opts {
+ switch opt := o.(type) {
+ case EmailOptMessageID:
+ id = int(opt)
+ case EmailOptFrom:
+ from = string(opt)
+ case EmailOptCC:
+ cc = []string(opt)
+ }
}
email := fmt.Sprintf(`Sender: %v
Date: Tue, 15 Aug 2017 14:59:00 -0700
Message-ID: <%v>
Subject: crash1
From: %v
-Cc: test@syzkaller.com, bugs@syzkaller.com
+Cc: %v
To: %v
Content-Type: text/plain
%v
-`, from, id, from, to, body)
+`, from, id, from, strings.Join(cc, ","), to, body)
c.expectOK(c.POST("/_ah/mail/", email))
}