Skip to content

Commit

Permalink
Tweak test
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 19, 2023
1 parent 527b32e commit c5f0c15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/models/optins.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (o *OptIn) Name() string { return o.o.Name }

const sqlSelectOptInsByOrg = `
SELECT ROW_TO_JSON(r) FROM (
SELECT id, uuid, name
SELECT id, uuid, name
FROM msgs_optin o
WHERE o.org_id = $1 AND o.is_active
ORDER BY o.id ASC
Expand All @@ -41,7 +41,7 @@ func loadOptIns(ctx context.Context, db *sql.DB, orgID OrgID) ([]assets.OptIn, e

rows, err := db.QueryContext(ctx, sqlSelectOptInsByOrg, orgID)
if err != nil {
return nil, errors.Wrapf(err, "error querying resthooks for org: %d", orgID)
return nil, errors.Wrapf(err, "error querying optins for org: %d", orgID)
}
defer rows.Close()

Expand All @@ -50,13 +50,13 @@ func loadOptIns(ctx context.Context, db *sql.DB, orgID OrgID) ([]assets.OptIn, e
optIn := &OptIn{}
err = dbutil.ScanJSON(rows, &optIn.o)
if err != nil {
return nil, errors.Wrap(err, "error scanning resthook row")
return nil, errors.Wrap(err, "error scanning optin row")
}

optIns = append(optIns, optIn)
}

logrus.WithField("elapsed", time.Since(start)).WithField("org_id", orgID).WithField("count", len(optIns)).Debug("loaded resthooks")
logrus.WithField("elapsed", time.Since(start)).WithField("org_id", orgID).WithField("count", len(optIns)).Debug("loaded optins")

return optIns, nil
}
2 changes: 1 addition & 1 deletion core/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestStartFlowBatch(t *testing.T) {
Returns(2)

assertdb.Query(t, rt.DB, `SELECT count(*) FROM msgs_msg WHERE contact_id = ANY($1) AND text = 'Hey, how are you?' AND org_id = 1 AND status = 'Q'
AND queued_on IS NOT NULL AND direction = 'O' AND msg_type = 'T' AND channel_id = $2`, pq.Array([]models.ContactID{testdata.Cathy.ID, testdata.Bob.ID}), testdata.TwilioChannel.ID).
AND queued_on IS NOT NULL AND direction = 'O' AND msg_type = 'T'`, pq.Array([]models.ContactID{testdata.Cathy.ID, testdata.Bob.ID})).
Returns(2)

assertdb.Query(t, rt.DB, `SELECT status FROM flows_flowstart WHERE id = $1`, start1.ID).Returns("P")
Expand Down

0 comments on commit c5f0c15

Please sign in to comment.