Skip to content

Commit a0c89f1

Browse files
authored
Merge pull request #740 from nyaruka/update_gocommon
Update gocommon
2 parents a1f8a06 + f5f1041 commit a0c89f1

File tree

3 files changed

+43
-13
lines changed

3 files changed

+43
-13
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/jmoiron/sqlx v1.4.0
1717
github.com/lib/pq v1.10.9
1818
github.com/nyaruka/ezconf v0.3.0
19-
github.com/nyaruka/gocommon v1.54.5
19+
github.com/nyaruka/gocommon v1.54.6
2020
github.com/nyaruka/null/v3 v3.0.0
2121
github.com/nyaruka/redisx v0.8.0
2222
github.com/patrickmn/go-cache v2.1.0+incompatible

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
7171
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
7272
github.com/nyaruka/ezconf v0.3.0 h1:kGvJqVN8AHowb4HdaHAviJ0Z3yI5Pyekp1WqibFEaGk=
7373
github.com/nyaruka/ezconf v0.3.0/go.mod h1:89GUW6EPRNLIxT7lC4LWnjWTgZeQwRoX7lBmc8ralAU=
74-
github.com/nyaruka/gocommon v1.54.5 h1:k5VXfXWZoE33wH/v5AgHQPbYjMBD6UsAz04uNnhp6bo=
75-
github.com/nyaruka/gocommon v1.54.5/go.mod h1:rWkEIpYIK98zL9Qm6PeMXJ+84WcWlArf01RfuWWCYvQ=
74+
github.com/nyaruka/gocommon v1.54.6 h1:cVe+d1upTLdNl/jIvpJhjcxrwsTYU7qGvhPckJsK1ig=
75+
github.com/nyaruka/gocommon v1.54.6/go.mod h1:rWkEIpYIK98zL9Qm6PeMXJ+84WcWlArf01RfuWWCYvQ=
7676
github.com/nyaruka/librato v1.1.1 h1:0nTYtJLl3Sn7lX3CuHsLf+nXy1k/tGV0OjVxLy3Et4s=
7777
github.com/nyaruka/librato v1.1.1/go.mod h1:fme1Fu1PT2qvkaBZyw8WW+SrnFe2qeeCWpvqmAaKAKE=
7878
github.com/nyaruka/null/v2 v2.0.3 h1:rdmMRQyVzrOF3Jff/gpU/7BDR9mQX0lcLl4yImsA3kw=

Diff for: handlers/mblox/handler_test.go

+40-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
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"}),
1515
}
1616

1717
var (
@@ -62,13 +62,31 @@ var (
6262
)
6363

6464
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+
},
7290
{
7391
Label: "Status Valid",
7492
URL: receiveURL,
@@ -77,8 +95,20 @@ var testCases = []IncomingTestCase{
7795
ExpectedBodyContains: `"status":"D"`,
7896
ExpectedStatuses: []ExpectedStatus{{ExternalID: "12345", Status: courier.MsgStatusDelivered}},
7997
},
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+
},
82112
}
83113

84114
func TestIncoming(t *testing.T) {

0 commit comments

Comments
 (0)