@@ -47,36 +47,36 @@ func TestDetectiveCheckMessageDeliveryHandler(t *testing.T) {
4747 })
4848
4949 Convey ("No Time Interval" , func () {
50- r , err := http .Get (fmt .Sprintf ("%s?mail_from=user1@example.org&mail_to=user2@example.org&page=1" , s .URL ))
50+ r , err := http .Get (fmt .Sprintf ("%s?mail_from=user1@example.org&mail_to=user2@example.org&status=-1& page=1" , s .URL ))
5151 So (err , ShouldBeNil )
5252 So (r .StatusCode , ShouldEqual , http .StatusUnprocessableEntity )
5353 })
5454
5555 emptyResult := detective.MessagesPage {}
5656
5757 Convey ("No Sender" , func () {
58- m .EXPECT ().CheckMessageDelivery (gomock .Any (), "" , "user2@example.org" , interval , 1 ).Return (& emptyResult , emailutil .ErrInvalidEmail )
59- r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_to=user2@example.org&page=1" , s .URL ))
58+ m .EXPECT ().CheckMessageDelivery (gomock .Any (), "" , "user2@example.org" , interval , - 1 , 1 ).Return (& emptyResult , emailutil .ErrInvalidEmail )
59+ r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_to=user2@example.org&status=-1& page=1" , s .URL ))
6060 So (err , ShouldBeNil )
6161 So (r .StatusCode , ShouldEqual , http .StatusUnprocessableEntity )
6262 })
6363
6464 Convey ("No Recipient" , func () {
65- m .EXPECT ().CheckMessageDelivery (gomock .Any (), "user1@example.org" , "" , interval , 1 ).Return (& emptyResult , emailutil .ErrInvalidEmail )
66- r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&page=1" , s .URL ))
65+ m .EXPECT ().CheckMessageDelivery (gomock .Any (), "user1@example.org" , "" , interval , - 1 , 1 ).Return (& emptyResult , emailutil .ErrInvalidEmail )
66+ r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&status=-1& page=1" , s .URL ))
6767 So (err , ShouldBeNil )
6868 So (r .StatusCode , ShouldEqual , http .StatusUnprocessableEntity )
6969 })
7070
7171 Convey ("Dates out of order" , func () {
7272 // "from" comes after "to"
73- r , err := http .Get (fmt .Sprintf ("%s?to=1999-01-01&from=1999-12-31&mail_from=user1@example.org&mail_to=user2&page=1" , s .URL ))
73+ r , err := http .Get (fmt .Sprintf ("%s?to=1999-01-01&from=1999-12-31&mail_from=user1@example.org&mail_to=user2&status=-1& page=1" , s .URL ))
7474 So (err , ShouldBeNil )
7575 So (r .StatusCode , ShouldEqual , http .StatusUnprocessableEntity )
7676 })
7777
7878 Convey ("No page" , func () {
79- r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&mail_to=user2@example.org" , s .URL ))
79+ r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&mail_to=user2@example.org&status=-1 " , s .URL ))
8080 So (err , ShouldBeNil )
8181 So (r .StatusCode , ShouldEqual , http .StatusUnprocessableEntity )
8282 })
@@ -97,15 +97,17 @@ func TestDetectiveCheckMessageDeliveryHandler(t *testing.T) {
9797 detective .Status (parser .SentStatus ),
9898 "2.0.0" ,
9999 nil ,
100+ "user1@example.org" ,
101+ "user2@example.org" ,
100102 },
101103 },
102104 },
103105 },
104106 }
105107
106- m .EXPECT ().CheckMessageDelivery (gomock .Any (), "user1@example.org" , "user2@example.org" , interval , 1 ).Return (& messages , nil )
108+ m .EXPECT ().CheckMessageDelivery (gomock .Any (), "user1@example.org" , "user2@example.org" , interval , - 1 , 1 ).Return (& messages , nil )
107109
108- r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&mail_to=user2@example.org&page=1" , s .URL ))
110+ r , err := http .Get (fmt .Sprintf ("%s?from=1999-01-01&to=1999-12-31&mail_from=user1@example.org&mail_to=user2@example.org&status=-1& page=1" , s .URL ))
109111 So (err , ShouldBeNil )
110112 So (r .StatusCode , ShouldEqual , http .StatusOK )
111113
@@ -177,7 +179,7 @@ func TestEscalation(t *testing.T) {
177179 s := httptest .NewServer (httpmiddleware .New ().WithEndpoint (detectiveEscalatorHandler {requester : e , detective : d }))
178180
179181 Convey ("No message escalated" , func () {
180- d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).Return (& detective.MessagesPage {}, nil )
182+ d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock . Any () ).Return (& detective.MessagesPage {}, nil )
181183
182184 r , err := http .PostForm (s .URL , url.Values {
183185 "from" : []string {"2000-01-01" },
@@ -192,7 +194,7 @@ func TestEscalation(t *testing.T) {
192194 })
193195
194196 Convey ("Internal error if detective check fails" , func () {
195- d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).Return (& detective.MessagesPage {}, errors .New (`Some error` ))
197+ d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock . Any () ).Return (& detective.MessagesPage {}, errors .New (`Some error` ))
196198
197199 r , err := http .PostForm (s .URL , url.Values {
198200 "from" : []string {"2000-01-01" },
@@ -220,7 +222,7 @@ func TestEscalation(t *testing.T) {
220222 })
221223
222224 Convey ("Escalate issue" , func () {
223- d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).Return (
225+ d .EXPECT ().CheckMessageDelivery (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any (), gomock . Any () ).Return (
224226 & detective.MessagesPage {
225227 PageNumber : 1 ,
226228 FirstPage : 1 ,
@@ -231,11 +233,13 @@ func TestEscalation(t *testing.T) {
231233 Queue : "AAA" ,
232234 Entries : []detective.MessageDelivery {
233235 {
234- TimeMin : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
235- TimeMax : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
236- Status : detective .Status (parser .BouncedStatus ),
237- Dsn : "3.4.6" ,
238- Expired : nil ,
236+ TimeMin : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
237+ TimeMax : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
238+ Status : detective .Status (parser .BouncedStatus ),
239+ Dsn : "3.4.6" ,
240+ Expired : nil ,
241+ MailFrom : "user1@example.com" ,
242+ MailTo : "user2@example.com" ,
239243 },
240244 },
241245 },
@@ -261,11 +265,13 @@ func TestEscalation(t *testing.T) {
261265 Queue : "AAA" ,
262266 Entries : []detective.MessageDelivery {
263267 {
264- TimeMin : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
265- TimeMax : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
266- Status : detective .Status (parser .BouncedStatus ),
267- Dsn : "3.4.6" ,
268- Expired : nil ,
268+ TimeMin : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
269+ TimeMax : timeutil .MustParseTime (`2000-01-01 10:00:00 +0000` ),
270+ Status : detective .Status (parser .BouncedStatus ),
271+ Dsn : "3.4.6" ,
272+ Expired : nil ,
273+ MailFrom : "user1@example.com" ,
274+ MailTo : "user2@example.com" ,
269275 },
270276 },
271277 },
0 commit comments