Skip to content

Commit

Permalink
Merge pull request rapidpro#433 from nyaruka/test_tweaks
Browse files Browse the repository at this point in the history
Simplify testdata functions
  • Loading branch information
rowanseymour authored Jun 2, 2021
2 parents b534620 + ad901ca commit 2fd5636
Show file tree
Hide file tree
Showing 30 changed files with 201 additions and 197 deletions.
2 changes: 1 addition & 1 deletion core/handlers/contact_urns_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestContactURNsChanged(t *testing.T) {
db := testsuite.DB()

// add a URN to george that cathy will steal
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.George.ID, urns.URN("tel:+12065551212"), 100)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.George, urns.URN("tel:+12065551212"), 100)

now := time.Now()

Expand Down
4 changes: 2 additions & 2 deletions core/handlers/input_labels_added_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestInputLabelsAdded(t *testing.T) {
reporting := assets.NewLabelReference(assets.LabelUUID("ebc4dedc-91c4-4ed4-9dd6-daa05ea82698"), "Reporting")
testing := assets.NewLabelReference(assets.LabelUUID("a6338cdc-7938-4437-8b05-2d5d785e3a08"), "Testing")

msg1 := testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start")
msg2 := testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Bob.ID, testdata.Bob.URN, testdata.Bob.URNID, "start")
msg1 := testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start")
msg2 := testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Bob.ID, testdata.Bob.URN, testdata.Bob.URNID, "start")

tcs := []handlers.TestCase{
{
Expand Down
6 changes: 3 additions & 3 deletions core/handlers/msg_created_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestMsgCreated(t *testing.T) {
defer func() { config.Mailroom.AttachmentDomain = "" }()

// add a URN for cathy so we can test all urn sends
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.Cathy.ID, urns.URN("tel:+12065551212"), 10)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.Cathy, urns.URN("tel:+12065551212"), 10)

// delete all messages and URNs for bob
db.MustExec(`DELETE FROM msgs_msg`)
Expand All @@ -36,7 +36,7 @@ func TestMsgCreated(t *testing.T) {
db.MustExec(`UPDATE contacts_contacturn SET identity = 'twitter:12345', path='12345', scheme='twitter' WHERE contact_id = $1`, testdata.Alexandria.ID)
db.MustExec(`UPDATE contacts_contact SET language='eng' WHERE id = $1`, testdata.Alexandria.ID)

msg1 := testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start")
msg1 := testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start")

templateAction := actions.NewSendMsg(handlers.NewActionUUID(), "Template time", nil, nil, false)
templateAction.Templating = &actions.Templating{
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestNewURN(t *testing.T) {
)

// give George a URN that Bob will steal
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.George.ID, urns.URN("telegram:67890"), 1)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.George, urns.URN("telegram:67890"), 1)

tcs := []handlers.TestCase{
{
Expand Down
2 changes: 1 addition & 1 deletion core/handlers/msg_received_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestMsgReceived(t *testing.T) {
},
},
Msgs: handlers.ContactMsgMap{
testdata.Cathy: testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start"),
testdata.Cathy: testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "start"),
},
SQLAssertions: []handlers.SQLAssertion{
{
Expand Down
28 changes: 14 additions & 14 deletions core/models/contacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ func TestContacts(t *testing.T) {
org, err := models.GetOrgAssets(ctx, db, 1)
assert.NoError(t, err)

testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.Bob.ID, urns.URN("whatsapp:250788373373"), 999)
testdata.InsertOpenTicket(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Mailgun.ID,
flows.TicketUUID("f808c16d-10ed-4dfd-a6d4-6331c0d618f8"), "Problem!", "Where are my shoes?", "1234")
testdata.InsertOpenTicket(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Zendesk.ID,
flows.TicketUUID("ddf9aa25-73d8-4c5a-bf63-f4e9525bbb3e"), "Another Problem!", "Where are my pants?", "2345")
testdata.InsertOpenTicket(t, db, testdata.Org1.ID, testdata.Bob.ID, testdata.Mailgun.ID,
flows.TicketUUID("e86d6cc3-6acc-49d0-9a50-287e4794e415"), "Urgent", "His name is Bob", "")
testdata.InsertContactURN(t, db, testdata.Org1, testdata.Bob, "whatsapp:250788373373", 999)
testdata.InsertOpenTicket(t, db, testdata.Org1, testdata.Cathy, testdata.Mailgun,
"f808c16d-10ed-4dfd-a6d4-6331c0d618f8", "Problem!", "Where are my shoes?", "1234")
testdata.InsertOpenTicket(t, db, testdata.Org1, testdata.Cathy, testdata.Zendesk,
"ddf9aa25-73d8-4c5a-bf63-f4e9525bbb3e", "Another Problem!", "Where are my pants?", "2345")
testdata.InsertOpenTicket(t, db, testdata.Org1, testdata.Bob, testdata.Mailgun,
"e86d6cc3-6acc-49d0-9a50-287e4794e415", "Urgent", "His name is Bob", "")

db.MustExec(`DELETE FROM contacts_contacturn WHERE contact_id = $1`, testdata.George.ID)
db.MustExec(`DELETE FROM contacts_contactgroup_contacts WHERE contact_id = $1`, testdata.George.ID)
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestContacts(t *testing.T) {
assert.Equal(t, "whatsapp:250788373373?id=20121&priority=999", bob.URNs()[1].String())

// add another tel urn to bob
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.Bob.ID, urns.URN("tel:+250788373373"), 10)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.Bob, urns.URN("tel:+250788373373"), 10)

// reload the contact
modelContacts, err = models.LoadContacts(ctx, db, org, []models.ContactID{testdata.Bob.ID})
Expand Down Expand Up @@ -134,10 +134,10 @@ func TestCreateContact(t *testing.T) {
testsuite.Reset()
models.FlushCache()

testdata.InsertContactGroup(t, db, testdata.Org1.ID, "d636c966-79c1-4417-9f1c-82ad629773a2", "Kinyarwanda", "language = kin")
testdata.InsertContactGroup(t, db, testdata.Org1, "d636c966-79c1-4417-9f1c-82ad629773a2", "Kinyarwanda", "language = kin")

// add an orphaned URN
testdata.InsertContactURN(t, db, testdata.Org1.ID, models.NilContactID, urns.URN("telegram:200002"), 100)
testdata.InsertContactURN(t, db, testdata.Org1, nil, urns.URN("telegram:200002"), 100)

oa, err := models.GetOrgAssets(ctx, db, testdata.Org1.ID)
require.NoError(t, err)
Expand Down Expand Up @@ -192,11 +192,11 @@ func TestGetOrCreateContact(t *testing.T) {
db := testsuite.DB()
testsuite.Reset()

testdata.InsertContactGroup(t, db, testdata.Org1.ID, "d636c966-79c1-4417-9f1c-82ad629773a2", "Telegrammer", `telegram = 100001`)
testdata.InsertContactGroup(t, db, testdata.Org1, "d636c966-79c1-4417-9f1c-82ad629773a2", "Telegrammer", `telegram = 100001`)

// add some orphaned URNs
testdata.InsertContactURN(t, db, testdata.Org1.ID, models.NilContactID, urns.URN("telegram:200001"), 100)
testdata.InsertContactURN(t, db, testdata.Org1.ID, models.NilContactID, urns.URN("telegram:200002"), 100)
testdata.InsertContactURN(t, db, testdata.Org1, nil, urns.URN("telegram:200001"), 100)
testdata.InsertContactURN(t, db, testdata.Org1, nil, urns.URN("telegram:200002"), 100)

var maxContactID models.ContactID
db.Get(&maxContactID, `SELECT max(id) FROM contacts_contact`)
Expand Down Expand Up @@ -350,7 +350,7 @@ func TestGetOrCreateContactIDsFromURNs(t *testing.T) {
testsuite.Reset()

// add an orphaned URN
testdata.InsertContactURN(t, db, testdata.Org1.ID, models.NilContactID, urns.URN("telegram:200001"), 100)
testdata.InsertContactURN(t, db, testdata.Org1, nil, urns.URN("telegram:200001"), 100)

var maxContactID models.ContactID
db.Get(&maxContactID, `SELECT max(id) FROM contacts_contact`)
Expand Down
8 changes: 4 additions & 4 deletions core/models/imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func TestContactImports(t *testing.T) {
testdata.DeleteContactsAndURNs(t, db)

// add contact in other org to make sure we can't update it
testdata.InsertContact(t, db, testdata.Org2.ID, "f7a8016d-69a6-434b-aae7-5142ce4a98ba", "Xavier", "spa")
testdata.InsertContact(t, db, testdata.Org2, "f7a8016d-69a6-434b-aae7-5142ce4a98ba", "Xavier", "spa")

// add dynamic group to test imported contacts are added to it
testdata.InsertContactGroup(t, db, testdata.Org1.ID, "fc32f928-ad37-477c-a88e-003d30fd7406", "Adults", "age >= 40")
testdata.InsertContactGroup(t, db, testdata.Org1, "fc32f928-ad37-477c-a88e-003d30fd7406", "Adults", "age >= 40")

// give our org a country by setting country on a channel
db.MustExec(`UPDATE channels_channel SET country = 'US' WHERE id = $1`, testdata.TwilioChannel.ID)
Expand All @@ -66,7 +66,7 @@ func TestContactImports(t *testing.T) {
defer uuids.SetGenerator(uuids.DefaultGenerator)

for i, tc := range tcs {
importID := testdata.InsertContactImport(t, db, testdata.Org1.ID)
importID := testdata.InsertContactImport(t, db, testdata.Org1)
batchID := testdata.InsertContactImportBatch(t, db, importID, tc.Specs)

batch, err := models.LoadContactImportBatch(ctx, db, batchID)
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestContactImportBatch(t *testing.T) {
ctx := testsuite.CTX()
db := testsuite.DB()

importID := testdata.InsertContactImport(t, db, testdata.Org1.ID)
importID := testdata.InsertContactImport(t, db, testdata.Org1)
batchID := testdata.InsertContactImportBatch(t, db, importID, []byte(`[
{"name": "Norbert", "language": "eng", "urns": ["tel:+16055740001"]},
{"name": "Leah", "urns": ["tel:+16055740002"]}
Expand Down
18 changes: 9 additions & 9 deletions core/models/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestOutgoingMsgs(t *testing.T) {
func TestGetMessageIDFromUUID(t *testing.T) {
ctx := testsuite.CTX()
db := testsuite.DB()
msgIn := testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "hi there")
msgIn := testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "hi there")

msgID, err := models.GetMessageIDFromUUID(ctx, db, msgIn.UUID())

Expand All @@ -151,11 +151,11 @@ func TestGetMessageIDFromUUID(t *testing.T) {
func TestLoadMessages(t *testing.T) {
ctx := testsuite.CTX()
db := testsuite.DB()
msgIn1 := testdata.InsertIncomingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "in 1")
msgOut1 := testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 1", []utils.Attachment{"image/jpeg:hi.jpg"})
msgOut2 := testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 2", nil)
msgOut3 := testdata.InsertOutgoingMsg(t, db, testdata.Org2.ID, testdata.Org2Contact.ID, testdata.Org2Contact.URN, testdata.Org2Contact.URNID, "out 3", nil)
testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "hi 3", nil)
msgIn1 := testdata.InsertIncomingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "in 1")
msgOut1 := testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 1", []utils.Attachment{"image/jpeg:hi.jpg"})
msgOut2 := testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 2", nil)
msgOut3 := testdata.InsertOutgoingMsg(t, db, testdata.Org2, testdata.Org2Contact.ID, testdata.Org2Contact.URN, testdata.Org2Contact.URNID, "out 3", nil)
testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "hi 3", nil)

ids := []models.MsgID{models.MsgID(msgIn1.ID()), models.MsgID(msgOut1.ID()), models.MsgID(msgOut2.ID()), models.MsgID(msgOut3.ID())}

Expand Down Expand Up @@ -186,9 +186,9 @@ func TestResendMessages(t *testing.T) {
oa, err := models.GetOrgAssets(ctx, db, testdata.Org1.ID)
require.NoError(t, err)

msgOut1 := testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 1", nil)
msgOut2 := testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Bob.ID, testdata.Bob.URN, testdata.Bob.URNID, "out 2", nil)
testdata.InsertOutgoingMsg(t, db, testdata.Org1.ID, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 3", nil)
msgOut1 := testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 1", nil)
msgOut2 := testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Bob.ID, testdata.Bob.URN, testdata.Bob.URNID, "out 2", nil)
testdata.InsertOutgoingMsg(t, db, testdata.Org1, testdata.Cathy.ID, testdata.Cathy.URN, testdata.Cathy.URNID, "out 3", nil)

// make them look like failed messages
db.MustExec(`UPDATE msgs_msg SET status = 'F', sent_on = NOW(), error_count = 3`)
Expand Down
2 changes: 1 addition & 1 deletion core/models/starts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestStarts(t *testing.T) {
ctx := testsuite.CTX()
db := testsuite.DB()

startID := testdata.InsertFlowStart(t, db, testdata.Org1.ID, testdata.SingleMessage.ID, []models.ContactID{testdata.Cathy.ID, testdata.Bob.ID})
startID := testdata.InsertFlowStart(t, db, testdata.Org1, testdata.SingleMessage, []*testdata.Contact{testdata.Cathy, testdata.Bob})

startJSON := []byte(fmt.Sprintf(`{
"start_id": %d,
Expand Down
12 changes: 6 additions & 6 deletions core/msgio/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ func TestSyncAndroidChannels(t *testing.T) {
fc := mockFCM.Client("FCMKEY123")

// create some Android channels
channel1ID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": ""}) // no FCM ID
channel2ID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 2", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID2"}) // invalid FCM ID
channel3ID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 3", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID3"}) // valid FCM ID
testChannel1 := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": ""}) // no FCM ID
testChannel2 := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 2", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID2"}) // invalid FCM ID
testChannel3 := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 3", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID3"}) // valid FCM ID

oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshChannels)
require.NoError(t, err)

channel1 := oa.ChannelByID(channel1ID)
channel2 := oa.ChannelByID(channel2ID)
channel3 := oa.ChannelByID(channel3ID)
channel1 := oa.ChannelByID(testChannel1.ID)
channel2 := oa.ChannelByID(testChannel2.ID)
channel3 := oa.ChannelByID(testChannel3.ID)

msgio.SyncAndroidChannels(fc, []*models.Channel{channel1, channel2, channel3})

Expand Down
4 changes: 2 additions & 2 deletions core/msgio/courier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestQueueCourierMessages(t *testing.T) {
defer rc.Close()

// create an Andoid channel
androidChannelID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID"})
androidChannel := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID"})

oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshOrg|models.RefreshChannels)
require.NoError(t, err)
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestQueueCourierMessages(t *testing.T) {
// check that trying to queue a courier message will panic
assert.Panics(t, func() {
ms := msgSpec{
ChannelID: androidChannelID,
ChannelID: androidChannel.ID,
ContactID: testdata.Cathy.ID,
URNID: testdata.Cathy.URNID,
}
Expand Down
14 changes: 7 additions & 7 deletions core/msgio/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func TestSendMessages(t *testing.T) {
fc := mockFCM.Client("FCMKEY123")

// create some Andoid channels
androidChannel1ID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID1"})
androidChannel2ID := testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 2", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID2"})
testdata.InsertChannel(t, db, testdata.Org1.ID, "A", "Android 3", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID3"})
androidChannel1 := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 1", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID1"})
androidChannel2 := testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 2", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID2"})
testdata.InsertChannel(t, db, testdata.Org1, "A", "Android 3", []string{"tel"}, "SR", map[string]interface{}{"FCM_ID": "FCMID3"})

oa, err := models.GetOrgAssetsWithRefresh(ctx, db, testdata.Org1.ID, models.RefreshChannels)
require.NoError(t, err)
Expand All @@ -88,7 +88,7 @@ func TestSendMessages(t *testing.T) {
URNID: testdata.Cathy.URNID,
},
{
ChannelID: androidChannel1ID,
ChannelID: androidChannel1.ID,
ContactID: testdata.Bob.ID,
URNID: testdata.Bob.URNID,
},
Expand All @@ -108,17 +108,17 @@ func TestSendMessages(t *testing.T) {
Description: "each Android channel synced once",
Msgs: []msgSpec{
{
ChannelID: androidChannel1ID,
ChannelID: androidChannel1.ID,
ContactID: testdata.Cathy.ID,
URNID: testdata.Cathy.URNID,
},
{
ChannelID: androidChannel2ID,
ChannelID: androidChannel2.ID,
ContactID: testdata.Bob.ID,
URNID: testdata.Bob.URNID,
},
{
ChannelID: androidChannel1ID,
ChannelID: androidChannel1.ID,
ContactID: testdata.Cathy.ID,
URNID: testdata.Cathy.URNID,
},
Expand Down
2 changes: 1 addition & 1 deletion core/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestBatchStart(t *testing.T) {
rp := testsuite.RP()

// create a start object
testdata.InsertFlowStart(t, db, testdata.Org1.ID, testdata.SingleMessage.ID, nil)
testdata.InsertFlowStart(t, db, testdata.Org1, testdata.SingleMessage, nil)

// and our batch object
contactIDs := []models.ContactID{testdata.Cathy.ID, testdata.Bob.ID}
Expand Down
4 changes: 2 additions & 2 deletions core/tasks/broadcasts/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestBroadcastEvents(t *testing.T) {
cathyOnly := []*flows.ContactReference{cathy}

// add an extra URN fo cathy
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.Cathy.ID, urns.URN("tel:+12065551212"), 1001)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.Cathy, urns.URN("tel:+12065551212"), 1001)

// change george's URN to an invalid twitter URN so it can't be sent
db.MustExec(
Expand Down Expand Up @@ -168,7 +168,7 @@ func TestBroadcastTask(t *testing.T) {
cathyOnly := []models.ContactID{testdata.Cathy.ID}

// add an extra URN fo cathy
testdata.InsertContactURN(t, db, testdata.Org1.ID, testdata.Cathy.ID, urns.URN("tel:+12065551212"), 1001)
testdata.InsertContactURN(t, db, testdata.Org1, testdata.Cathy, urns.URN("tel:+12065551212"), 1001)

tcs := []struct {
BroadcastID models.BroadcastID
Expand Down
2 changes: 1 addition & 1 deletion core/tasks/contacts/import_contact_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestImportContactBatch(t *testing.T) {

mr := &mailroom.Mailroom{Config: config.Mailroom, DB: db, RP: testsuite.RP(), ElasticClient: nil}

importID := testdata.InsertContactImport(t, db, testdata.Org1.ID)
importID := testdata.InsertContactImport(t, db, testdata.Org1)
batchID := testdata.InsertContactImportBatch(t, db, importID, []byte(`[
{"name": "Norbert", "language": "eng", "urns": ["tel:+16055740001"]},
{"name": "Leah", "urns": ["tel:+16055740002"]}
Expand Down
Loading

0 comments on commit 2fd5636

Please sign in to comment.