@@ -22,7 +22,6 @@ import (
22
22
"github.com/nyaruka/mailroom/testsuite/testdata"
23
23
"github.com/nyaruka/null"
24
24
"github.com/nyaruka/redisx/assertredis"
25
-
26
25
"github.com/stretchr/testify/assert"
27
26
"github.com/stretchr/testify/require"
28
27
)
@@ -176,7 +175,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
176
175
session .SetIncomingMsg (tc .ResponseTo , null .NullString )
177
176
}
178
177
179
- flowMsg := flows .NewMsgOut (tc .URN , assets .NewChannelReference (tc .ChannelUUID , "Test Channel" ), tc .Text , tc .Attachments , tc .QuickReplies , nil , tc .Topic , tc .Unsendable )
178
+ flowMsg := flows .NewMsgOut (tc .URN , assets .NewChannelReference (tc .ChannelUUID , "Test Channel" ), tc .Text , tc .Attachments , tc .QuickReplies , nil , tc .Topic , envs . NilLocale , tc .Unsendable )
180
179
msg , err := models .NewOutgoingFlowMsg (rt , oa .Org (), channel , session , flow , flowMsg , now )
181
180
182
181
assert .NoError (t , err )
@@ -221,7 +220,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
221
220
222
221
// check that msg loop detection triggers after 20 repeats of the same text
223
222
newOutgoing := func (text string ) * models.Msg {
224
- flowMsg := flows .NewMsgOut (urns .URN (fmt .Sprintf ("tel:+250700000001?id=%d" , testdata .Cathy .URNID )), assets .NewChannelReference (testdata .TwilioChannel .UUID , "Twilio" ), text , nil , nil , nil , flows .NilMsgTopic , flows .NilUnsendableReason )
223
+ flowMsg := flows .NewMsgOut (urns .URN (fmt .Sprintf ("tel:+250700000001?id=%d" , testdata .Cathy .URNID )), assets .NewChannelReference (testdata .TwilioChannel .UUID , "Twilio" ), text , nil , nil , nil , flows .NilMsgTopic , envs . NilLocale , flows .NilUnsendableReason )
225
224
msg , err := models .NewOutgoingFlowMsg (rt , oa .Org (), channel , session , flow , flowMsg , now )
226
225
require .NoError (t , err )
227
226
return msg
@@ -266,6 +265,7 @@ func TestMarshalMsg(t *testing.T) {
266
265
[]string {"yes" , "no" },
267
266
nil ,
268
267
flows .MsgTopicPurchase ,
268
+ envs .NilLocale ,
269
269
flows .NilUnsendableReason ,
270
270
)
271
271
@@ -324,6 +324,7 @@ func TestMarshalMsg(t *testing.T) {
324
324
"Hi there" ,
325
325
nil , nil , nil ,
326
326
flows .NilMsgTopic ,
327
+ envs .NilLocale ,
327
328
flows .NilUnsendableReason ,
328
329
)
329
330
in1 := testdata .InsertIncomingMsg (db , testdata .Org1 , testdata .TwilioChannel , testdata .Cathy , "test" , models .MsgStatusHandled )
@@ -366,7 +367,7 @@ func TestMarshalMsg(t *testing.T) {
366
367
367
368
// try a broadcast message which won't have session and flow fields set
368
369
bcastID := testdata .InsertBroadcast (db , testdata .Org1 , `eng` , map [envs.Language ]string {`eng` : "Blast" }, models .NilScheduleID , []* testdata.Contact {testdata .Cathy }, nil )
369
- bcastMsg1 := flows .NewMsgOut (urn , assets .NewChannelReference (testdata .TwilioChannel .UUID , "Test Channel" ), "Blast" , nil , nil , nil , flows .NilMsgTopic , flows .NilUnsendableReason )
370
+ bcastMsg1 := flows .NewMsgOut (urn , assets .NewChannelReference (testdata .TwilioChannel .UUID , "Test Channel" ), "Blast" , nil , nil , nil , flows .NilMsgTopic , envs . NilLocale , flows .NilUnsendableReason )
370
371
msg3 , err := models .NewOutgoingBroadcastMsg (rt , oa .Org (), channel , cathy , bcastMsg1 , time .Date (2021 , 11 , 9 , 14 , 3 , 30 , 0 , time .UTC ), bcastID )
371
372
require .NoError (t , err )
372
373
@@ -526,8 +527,8 @@ func TestGetMsgRepetitions(t *testing.T) {
526
527
oa := testdata .Org1 .Load (rt )
527
528
_ , cathy := testdata .Cathy .Load (db , oa )
528
529
529
- msg1 := flows .NewMsgOut (testdata .Cathy .URN , nil , "foo" , nil , nil , nil , flows .NilMsgTopic , flows .NilUnsendableReason )
530
- msg2 := flows .NewMsgOut (testdata .Cathy .URN , nil , "bar" , nil , nil , nil , flows .NilMsgTopic , flows .NilUnsendableReason )
530
+ msg1 := flows .NewMsgOut (testdata .Cathy .URN , nil , "foo" , nil , nil , nil , flows .NilMsgTopic , envs . NilLocale , flows .NilUnsendableReason )
531
+ msg2 := flows .NewMsgOut (testdata .Cathy .URN , nil , "bar" , nil , nil , nil , flows .NilMsgTopic , envs . NilLocale , flows .NilUnsendableReason )
531
532
532
533
assertRepetitions := func (m * flows.MsgOut , expected int ) {
533
534
count , err := models .GetMsgRepetitions (rp , cathy , m )
@@ -694,7 +695,7 @@ func TestNewOutgoingIVR(t *testing.T) {
694
695
695
696
createdOn := time .Date (2021 , 7 , 26 , 12 , 6 , 30 , 0 , time .UTC )
696
697
697
- flowMsg := flows .NewIVRMsgOut (testdata .Cathy .URN , vonage .ChannelReference (), "Hello" , "eng" , " http://example.com/hi.mp3" )
698
+ flowMsg := flows .NewIVRMsgOut (testdata .Cathy .URN , vonage .ChannelReference (), "Hello" , "http://example.com/hi.mp3" , "eng " )
698
699
dbMsg := models .NewOutgoingIVR (rt .Config , testdata .Org1 .ID , conn , flowMsg , createdOn )
699
700
700
701
assert .Equal (t , flowMsg .UUID (), dbMsg .UUID ())
0 commit comments