@@ -67,9 +67,8 @@ func prepareMailerTest(t *testing.T) (doer *user_model.User, repo *repo_model.Re
67
67
func TestComposeIssueCommentMessage (t * testing.T ) {
68
68
doer , _ , issue , comment := prepareMailerTest (t )
69
69
70
- stpl := texttmpl .Must (texttmpl .New ("issue/comment" ).Parse (subjectTpl ))
71
- btpl := template .Must (template .New ("issue/comment" ).Parse (bodyTpl ))
72
- InitMailRender (stpl , btpl )
70
+ subjectTemplates = texttmpl .Must (texttmpl .New ("issue/comment" ).Parse (subjectTpl ))
71
+ bodyTemplates = template .Must (template .New ("issue/comment" ).Parse (bodyTpl ))
73
72
74
73
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }, {
Name :
"Test2" ,
Email :
"[email protected] " }}
75
74
msgs , err := composeIssueCommentMessages (& mailCommentContext {
@@ -97,9 +96,8 @@ func TestComposeIssueCommentMessage(t *testing.T) {
97
96
func TestComposeIssueMessage (t * testing.T ) {
98
97
doer , _ , issue , _ := prepareMailerTest (t )
99
98
100
- stpl := texttmpl .Must (texttmpl .New ("issue/new" ).Parse (subjectTpl ))
101
- btpl := template .Must (template .New ("issue/new" ).Parse (bodyTpl ))
102
- InitMailRender (stpl , btpl )
99
+ subjectTemplates = texttmpl .Must (texttmpl .New ("issue/new" ).Parse (subjectTpl ))
100
+ bodyTemplates = template .Must (template .New ("issue/new" ).Parse (bodyTpl ))
103
101
104
102
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }, {
Name :
"Test2" ,
Email :
"[email protected] " }}
105
103
msgs , err := composeIssueCommentMessages (& mailCommentContext {
@@ -128,17 +126,15 @@ func TestTemplateSelection(t *testing.T) {
128
126
doer , repo , issue , comment := prepareMailerTest (t )
129
127
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }}
130
128
131
- stpl : = texttmpl .Must (texttmpl .New ("issue/default" ).Parse ("issue/default/subject" ))
132
- texttmpl .Must (stpl .New ("issue/new" ).Parse ("issue/new/subject" ))
133
- texttmpl .Must (stpl .New ("pull/comment" ).Parse ("pull/comment/subject" ))
134
- texttmpl .Must (stpl .New ("issue/close" ).Parse ("" )) // Must default to fallback subject
129
+ subjectTemplates = texttmpl .Must (texttmpl .New ("issue/default" ).Parse ("issue/default/subject" ))
130
+ texttmpl .Must (subjectTemplates .New ("issue/new" ).Parse ("issue/new/subject" ))
131
+ texttmpl .Must (subjectTemplates .New ("pull/comment" ).Parse ("pull/comment/subject" ))
132
+ texttmpl .Must (subjectTemplates .New ("issue/close" ).Parse ("" )) // Must default to fallback subject
135
133
136
- btpl := template .Must (template .New ("issue/default" ).Parse ("issue/default/body" ))
137
- template .Must (btpl .New ("issue/new" ).Parse ("issue/new/body" ))
138
- template .Must (btpl .New ("pull/comment" ).Parse ("pull/comment/body" ))
139
- template .Must (btpl .New ("issue/close" ).Parse ("issue/close/body" ))
140
-
141
- InitMailRender (stpl , btpl )
134
+ bodyTemplates = template .Must (template .New ("issue/default" ).Parse ("issue/default/body" ))
135
+ template .Must (bodyTemplates .New ("issue/new" ).Parse ("issue/new/body" ))
136
+ template .Must (bodyTemplates .New ("pull/comment" ).Parse ("pull/comment/body" ))
137
+ template .Must (bodyTemplates .New ("issue/close" ).Parse ("issue/close/body" ))
142
138
143
139
expect := func (t * testing.T , msg * Message , expSubject , expBody string ) {
144
140
subject := msg .ToMessage ().GetHeader ("Subject" )
@@ -187,9 +183,8 @@ func TestTemplateServices(t *testing.T) {
187
183
expect := func (t * testing.T , issue * issues_model.Issue , comment * issues_model.Comment , doer * user_model.User ,
188
184
actionType models.ActionType , fromMention bool , tplSubject , tplBody , expSubject , expBody string ,
189
185
) {
190
- stpl := texttmpl .Must (texttmpl .New ("issue/default" ).Parse (tplSubject ))
191
- btpl := template .Must (template .New ("issue/default" ).Parse (tplBody ))
192
- InitMailRender (stpl , btpl )
186
+ subjectTemplates = texttmpl .Must (texttmpl .New ("issue/default" ).Parse (tplSubject ))
187
+ bodyTemplates = template .Must (template .New ("issue/default" ).Parse (tplBody ))
193
188
194
189
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }}
195
190
msg := testComposeIssueCommentMessage (t , & mailCommentContext {
0 commit comments