@@ -93,20 +93,20 @@ func TestComposeIssueCommentMessage(t *testing.T) {
93
93
assert .NoError (t , err )
94
94
assert .Len (t , msgs , 2 )
95
95
gomailMsg := msgs [0 ].ToMessage ()
96
- replyTo := gomailMsg .GetHeader ("Reply-To" )[0 ]
97
- subject := gomailMsg .GetHeader ("Subject" )[0 ]
96
+ replyTo := gomailMsg .GetGenHeader ("Reply-To" )[0 ]
97
+ subject := gomailMsg .GetGenHeader ("Subject" )[0 ]
98
98
99
- assert .Len (t , gomailMsg .GetHeader ("To" ), 1 , "exactly one recipient is expected in the To field" )
99
+ assert .Len (t , gomailMsg .GetGenHeader ("To" ), 1 , "exactly one recipient is expected in the To field" )
100
100
tokenRegex := regexp .MustCompile (`\Aincoming\+(.+)@localhost\z` )
101
101
assert .Regexp (t , tokenRegex , replyTo )
102
102
token := tokenRegex .FindAllStringSubmatch (replyTo , 1 )[0 ][1 ]
103
103
assert .Equal (t , "Re: " , subject [:4 ], "Comment reply subject should contain Re:" )
104
104
assert .Equal (t , "Re: [user2/repo1] @user2 #1 - issue1" , subject )
105
- assert .Equal (t , "<user2/repo1/issues/1@localhost>" , gomailMsg .GetHeader ("In-Reply-To" )[0 ], "In-Reply-To header doesn't match" )
106
- assert .ElementsMatch (t , []string {"<user2/repo1/issues/1@localhost>" , "<reply-" + token + "@localhost>" }, gomailMsg .GetHeader ("References" ), "References header doesn't match" )
107
- assert .Equal (t , "<user2/repo1/issues/1/comment/2@localhost>" , gomailMsg .GetHeader ("Message-ID" )[0 ], "Message-ID header doesn't match" )
108
- assert .Equal (t , "<mailto:" + replyTo + ">" , gomailMsg .GetHeader ("List-Post" )[0 ])
109
- assert .Len (t , gomailMsg .GetHeader ("List-Unsubscribe" ), 2 ) // url + mailto
105
+ assert .Equal (t , "<user2/repo1/issues/1@localhost>" , gomailMsg .GetGenHeader ("In-Reply-To" )[0 ], "In-Reply-To header doesn't match" )
106
+ assert .ElementsMatch (t , []string {"<user2/repo1/issues/1@localhost>" , "<reply-" + token + "@localhost>" }, gomailMsg .GetGenHeader ("References" ), "References header doesn't match" )
107
+ assert .Equal (t , "<user2/repo1/issues/1/comment/2@localhost>" , gomailMsg .GetGenHeader ("Message-ID" )[0 ], "Message-ID header doesn't match" )
108
+ assert .Equal (t , "<mailto:" + replyTo + ">" , gomailMsg .GetGenHeader ("List-Post" )[0 ])
109
+ assert .Len (t , gomailMsg .GetGenHeader ("List-Unsubscribe" ), 2 ) // url + mailto
110
110
111
111
var buf bytes.Buffer
112
112
gomailMsg .WriteTo (& buf )
@@ -139,19 +139,19 @@ func TestComposeIssueMessage(t *testing.T) {
139
139
assert .Len (t , msgs , 2 )
140
140
141
141
gomailMsg := msgs [0 ].ToMessage ()
142
- mailto := gomailMsg .GetHeader ("To" )
143
- subject := gomailMsg .GetHeader ("Subject" )
144
- messageID := gomailMsg .GetHeader ("Message-ID" )
145
- inReplyTo := gomailMsg .GetHeader ("In-Reply-To" )
146
- references := gomailMsg .GetHeader ("References" )
142
+ mailto := gomailMsg .GetGenHeader ("To" )
143
+ subject := gomailMsg .GetGenHeader ("Subject" )
144
+ messageID := gomailMsg .GetGenHeader ("Message-ID" )
145
+ inReplyTo := gomailMsg .GetGenHeader ("In-Reply-To" )
146
+ references := gomailMsg .GetGenHeader ("References" )
147
147
148
148
assert .Len (t , mailto , 1 , "exactly one recipient is expected in the To field" )
149
149
assert .Equal (t , "[user2/repo1] @user2 #1 - issue1" , subject [0 ])
150
150
assert .Equal (t , "<user2/repo1/issues/1@localhost>" , inReplyTo [0 ], "In-Reply-To header doesn't match" )
151
151
assert .Equal (t , "<user2/repo1/issues/1@localhost>" , references [0 ], "References header doesn't match" )
152
152
assert .Equal (t , "<user2/repo1/issues/1@localhost>" , messageID [0 ], "Message-ID header doesn't match" )
153
- assert .Empty (t , gomailMsg .GetHeader ("List-Post" )) // incoming mail feature disabled
154
- assert .Len (t , gomailMsg .GetHeader ("List-Unsubscribe" ), 1 ) // url without mailto
153
+ assert .Empty (t , gomailMsg .GetGenHeader ("List-Post" )) // incoming mail feature disabled
154
+ assert .Len (t , gomailMsg .GetGenHeader ("List-Unsubscribe" ), 1 ) // url without mailto
155
155
}
156
156
157
157
func TestTemplateSelection (t * testing.T ) {
@@ -169,7 +169,7 @@ func TestTemplateSelection(t *testing.T) {
169
169
template .Must (bodyTemplates .New ("issue/close" ).Parse ("issue/close/body" ))
170
170
171
171
expect := func (t * testing.T , msg * sender_service.Message , expSubject , expBody string ) {
172
- subject := msg .ToMessage ().GetHeader ("Subject" )
172
+ subject := msg .ToMessage ().GetGenHeader ("Subject" )
173
173
msgbuf := new (bytes.Buffer )
174
174
_ , _ = msg .ToMessage ().WriteTo (msgbuf )
175
175
wholemsg := msgbuf .String ()
@@ -225,7 +225,7 @@ func TestTemplateServices(t *testing.T) {
225
225
Content : "test body" , Comment : comment ,
226
226
}, recipients , fromMention , "TestTemplateServices" )
227
227
228
- subject := msg .ToMessage ().GetHeader ("Subject" )
228
+ subject := msg .ToMessage ().GetGenHeader ("Subject" )
229
229
msgbuf := new (bytes.Buffer )
230
230
_ , _ = msg .ToMessage ().WriteTo (msgbuf )
231
231
wholemsg := msgbuf .String ()
0 commit comments