@@ -11,7 +11,7 @@ import (
11
11
)
12
12
13
13
var testChannels = []courier.Channel {
14
- test .NewMockChannel ("8eb23e93-5ecb-45ba-b726-3b064e0c56ab" , "MB" , "2020" , "BR " , map [string ]any {"username" : "zv-username" , "password" : "zv-password" }),
14
+ test .NewMockChannel ("8eb23e93-5ecb-45ba-b726-3b064e0c56ab" , "MB" , "2020" , "US " , map [string ]any {"username" : "zv-username" , "password" : "zv-password" }),
15
15
}
16
16
17
17
var (
@@ -62,13 +62,31 @@ var (
62
62
)
63
63
64
64
var testCases = []IncomingTestCase {
65
- {Label : "Receive Valid" , URL : receiveURL , Data : validReceive , ExpectedRespStatus : 200 , ExpectedBodyContains : "Message Accepted" ,
66
- ExpectedMsgText : Sp ("Hello World" ), ExpectedURN : "tel:+12067799294" , ExpectedDate : time .Date (2016 , 3 , 30 , 19 , 33 , 06 , 643000000 , time .UTC ),
67
- ExpectedExternalID : "OzQ5UqIOdoY8" },
68
-
69
- {Label : "Receive Missing Params" , URL : receiveURL , Data : missingParamsRecieve , ExpectedRespStatus : 400 , ExpectedBodyContains : "missing one of 'id', 'from', 'to', 'body' or 'received_at' in request body" },
70
- {Label : "Invalid URN" , URL : receiveURL , Data : invalidURN , ExpectedRespStatus : 400 , ExpectedBodyContains : "phone number supplied is not a number" },
71
-
65
+ {
66
+ Label : "Receive Valid" ,
67
+ URL : receiveURL ,
68
+ Data : validReceive ,
69
+ ExpectedRespStatus : 200 ,
70
+ ExpectedBodyContains : "Message Accepted" ,
71
+ ExpectedMsgText : Sp ("Hello World" ),
72
+ ExpectedURN : "tel:+12067799294" ,
73
+ ExpectedDate : time .Date (2016 , 3 , 30 , 19 , 33 , 06 , 643000000 , time .UTC ),
74
+ ExpectedExternalID : "OzQ5UqIOdoY8" ,
75
+ },
76
+ {
77
+ Label : "Receive Missing Params" ,
78
+ URL : receiveURL ,
79
+ Data : missingParamsRecieve ,
80
+ ExpectedRespStatus : 400 ,
81
+ ExpectedBodyContains : "missing one of 'id', 'from', 'to', 'body' or 'received_at' in request body" ,
82
+ },
83
+ {
84
+ Label : "Invalid URN" ,
85
+ URL : receiveURL ,
86
+ Data : invalidURN ,
87
+ ExpectedRespStatus : 400 ,
88
+ ExpectedBodyContains : "phone number supplied is not a number" ,
89
+ },
72
90
{
73
91
Label : "Status Valid" ,
74
92
URL : receiveURL ,
@@ -77,8 +95,20 @@ var testCases = []IncomingTestCase{
77
95
ExpectedBodyContains : `"status":"D"` ,
78
96
ExpectedStatuses : []ExpectedStatus {{ExternalID : "12345" , Status : courier .MsgStatusDelivered }},
79
97
},
80
- {Label : "Status Unknown" , URL : receiveURL , Data : unknownStatus , ExpectedRespStatus : 400 , ExpectedBodyContains : `unknown status 'INVALID'` },
81
- {Label : "Status Missing Batch ID" , URL : receiveURL , Data : missingBatchID , ExpectedRespStatus : 400 , ExpectedBodyContains : "missing one of 'batch_id' or 'status' in request body" },
98
+ {
99
+ Label : "Status Unknown" ,
100
+ URL : receiveURL ,
101
+ Data : unknownStatus ,
102
+ ExpectedRespStatus : 400 ,
103
+ ExpectedBodyContains : `unknown status 'INVALID'` ,
104
+ },
105
+ {
106
+ Label : "Status Missing Batch ID" ,
107
+ URL : receiveURL ,
108
+ Data : missingBatchID ,
109
+ ExpectedRespStatus : 400 ,
110
+ ExpectedBodyContains : "missing one of 'batch_id' or 'status' in request body" ,
111
+ },
82
112
}
83
113
84
114
func TestIncoming (t * testing.T ) {
0 commit comments