Skip to content

Commit

Permalink
resolve compatibility conflicts and divergences between nyaruka/v8.2.…
Browse files Browse the repository at this point in the history
…0 and Ilhasoft/main
  • Loading branch information
rasoro committed Nov 27, 2024
1 parent d7d992d commit fe21208
Show file tree
Hide file tree
Showing 26 changed files with 168 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
fail_ci_if_error: false

release:
name: Release
Expand Down
2 changes: 0 additions & 2 deletions core/handlers/msg_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ func handleMsgCreated(ctx context.Context, rt *runtime.Runtime, tx *sqlx.Tx, oa
if _, valid := validLanguageCodes[languageCode]; !valid {
languageCode = ""
}

event.Msg.TextLanguage = envs.Language(languageCode)
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions core/models/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ func buildMsgMetadata(m *flows.MsgOut) map[string]interface{} {
if m.Topic() != flows.NilMsgTopic {
metadata["topic"] = string(m.Topic())
}
if m.TextLanguage != "" {
metadata["text_language"] = m.TextLanguage
}
return metadata
}

Expand Down Expand Up @@ -552,8 +549,7 @@ SELECT
channel_id,
contact_id,
contact_urn_id,
org_id,
topup_id
org_id
FROM
msgs_msg
WHERE
Expand Down
12 changes: 6 additions & 6 deletions core/models/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,17 @@ func insertTestSession(t *testing.T, ctx context.Context, rt *runtime.Runtime, o
}

func TestSelectContactMessages(t *testing.T) {
ctx, _, db, _ := testsuite.Get()
ctx, rt := testsuite.Runtime()
defer testsuite.Reset(testsuite.ResetData)

thisMoment := time.Now()

testdata.InsertIncomingMsg(db, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "in 1", models.MsgStatusHandled)
testdata.InsertOutgoingMsg(db, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "out 1", []utils.Attachment{"image/jpeg:hi.jpg"}, models.MsgStatusSent, false)
testdata.InsertOutgoingMsg(db, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "out 2", nil, models.MsgStatusSent, false)
testdata.InsertOutgoingMsg(db, testdata.Org2, testdata.Org2Channel, testdata.Org2Contact, "out 3", nil, models.MsgStatusSent, false)
testdata.InsertIncomingMsg(rt, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "in 1", models.MsgStatusHandled)
testdata.InsertOutgoingMsg(rt, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "out 1", []utils.Attachment{"image/jpeg:hi.jpg"}, models.MsgStatusSent, false)
testdata.InsertOutgoingMsg(rt, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "out 2", nil, models.MsgStatusSent, false)
testdata.InsertOutgoingMsg(rt, testdata.Org2, testdata.Org2Channel, testdata.Org2Contact, "out 3", nil, models.MsgStatusSent, false)

msgs, err := models.SelectContactMessages(ctx, db, int(testdata.Cathy.ID), thisMoment)
msgs, err := models.SelectContactMessages(ctx, rt.DB, int(testdata.Cathy.ID), thisMoment)

// shoud only return messages for testdata.Cathy
assert.NoError(t, err)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ require (
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
)

require gopkg.in/go-playground/validator.v9 v9.31.0 // indirect

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69 // indirect
Expand Down
28 changes: 4 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69 h1:gPoXdwo3sKq8qcfM
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69/go.mod h1:RS+Gaowa0M+gCuiFAiRMGBCMqxLrNA7TESTU/Wbblm8=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 h1:npHgfD4Tl2WJS3AJaMUi5ynGDPUBfkg3U3fCzDyXZ+4=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
github.com/aws/aws-sdk-go v1.44.204 h1:7/tPUXfNOHB390A63t6fJIwmlwVQAkAwcbzKsU2/6OQ=
github.com/aws/aws-sdk-go v1.44.204/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.305 h1:fU/5lY3WyBjGU9fkmQYd8o4fZu+2RaOv/i+sPaJVvFg=
github.com/aws/aws-sdk-go v1.44.305/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
Expand Down Expand Up @@ -47,23 +45,12 @@ github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/gomodule/redigo v1.8.9 h1:Sl3u+2BI/kk+VEatbj0scLdrFhjPmbxOc1myhDP41ws=
github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
Expand All @@ -82,14 +69,12 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
Expand All @@ -104,8 +89,6 @@ github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/nyaruka/ezconf v0.2.1 h1:TDXWoqjqYya1uhou1mAJZg7rgFYL98EB0Tb3+BWtUh0=
github.com/nyaruka/ezconf v0.2.1/go.mod h1:ey182kYkw2MIi4XiWe1FR/mzI33WCmTWuceDYYxgnQw=
github.com/nyaruka/gocommon v1.37.0 h1:1wCSJtdjpBQ4FXWQy5zXBSiHENGEpL6sTy5IN79+0Iw=
github.com/nyaruka/gocommon v1.37.0/go.mod h1:HaUQmWPrZfKS9MLnXKQj28zF4KlJrzFou+DGuqT7RbE=
github.com/nyaruka/goflow v0.187.0 h1:HvMtTSLNdQwC2hCILkeA7jiffRuN7qpe5dLj4WDWMWY=
github.com/nyaruka/goflow v0.187.0/go.mod h1:8O8eCOZWBYYapaAQhRkdD9pYWcon4Mj1LQtxXV/GuXY=
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
Expand All @@ -128,21 +111,15 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI=
github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y=
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -207,6 +184,9 @@ gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M=
gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk=
gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
1 change: 0 additions & 1 deletion mailroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func (mr *Mailroom) Start() error {
}
mr.rt.AttachmentStorage = storage.NewS3(s3Client, mr.rt.Config.S3AttachmentsBucket, c.S3Region, s3.BucketCannedACLPublicRead, 32)
mr.rt.SessionStorage = storage.NewS3(s3Client, mr.rt.Config.S3SessionsBucket, c.S3Region, s3.ObjectCannedACLPrivate, 32)
mr.rt.LogStorage = storage.NewS3(s3Client, mr.rt.Config.S3LogsBucket, c.S3Region, s3.ObjectCannedACLPrivate, 32)
} else {
mr.rt.AttachmentStorage = storage.NewFS("_storage/attachments", 0766)
mr.rt.SessionStorage = storage.NewFS("_storage/sessions", 0766)
Expand Down
Binary file modified mailroom_test.dump
Binary file not shown.
3 changes: 1 addition & 2 deletions runtime/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Config struct {
S3Region string `help:"the S3 region we will write attachments to"`
S3AttachmentsBucket string `help:"the S3 bucket we will write attachments to"`
S3AttachmentsPrefix string `help:"the prefix that will be added to attachment filenames"`
S3SessionBucket string `help:"the S3 bucket we will write attachments to"`
S3SessionsBucket string `help:"the S3 bucket we will write attachments to"`
S3SessionPrefix string `help:"the prefix that will be added to attachment filenames"`
S3MediaPrefixZendesk string `help:"the prefix that will be added to file attachment names for Zendesk tickets"`
S3DisableSSL bool `help:"whether we disable SSL when accessing S3. Should always be set to False unless you're hosting an S3 compatible service within a secure internal network"`
Expand Down Expand Up @@ -124,7 +124,6 @@ func NewDefaultConfig() *Config {
S3AttachmentsBucket: "attachments-bucket",
S3AttachmentsPrefix: "attachments/",
S3SessionsBucket: "sessions-bucket",
S3LogsBucket: "logs-bucket",
S3DisableSSL: false,
S3ForcePathStyle: false,

Expand Down
2 changes: 1 addition & 1 deletion services/tickets/rocketchat/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestCreateRoom(t *testing.T) {
assert.EqualError(t, err, "unable to connect to server")

_, _, err = client.CreateRoom(room)
assert.EqualError(t, err, "Could not find a department for name: kitchen")
assert.EqualError(t, err, "There's no agents online")

id, trace, err := client.CreateRoom(room)
assert.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GET /api/apps/public/684202ed-1461-4983-9ea7-fde74b15026c/room HTTP/1.1
Host: my.rocket.chat
User-Agent: Go-http-client/1.1
Content-Length: 237
Content-Length: 199
Authorization: Token ****************
Content-Type: application/json
Accept-Encoding: gzip

{"visitor":{"token":"1234567","contactUUID":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis","email":"[email protected]","phone":"+12024561111"},"ticketID":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","sessionStart":"2019-10-07T15:20:30Z"}
{"visitor":{"token":"1234567","contactUUID":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis","email":"[email protected]","phone":"+12024561111"},"ticketID":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c"}
4 changes: 2 additions & 2 deletions services/tickets/twilioflex/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestOpenAndForward(t *testing.T) {
ctx, rt, _, _ := testsuite.Get()
ctx, rt := testsuite.Runtime()
testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

defer dates.SetNowSource(dates.DefaultNowSource)
Expand Down Expand Up @@ -353,7 +353,7 @@ func TestOpenAndForward(t *testing.T) {
}

func TestCloseAndReopen(t *testing.T) {
_, rt, _, _ := testsuite.Get()
_, rt := testsuite.Runtime()

defer uuids.SetGenerator(uuids.DefaultGenerator)
defer httpx.SetRequestor(httpx.DefaultRequestor)
Expand Down
2 changes: 1 addition & 1 deletion services/tickets/twilioflex/testdata/event_callback.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
},
"db_assertions": [
{
"query": "select count(*) from msgs_msg where direction = 'O' and attachments = '{image/jpeg:https:///_test_media_storage/media/1/6929/26ea/692926ea-09d6-4942-bd38-d266ec8d3716}'",
"query": "select count(*) from msgs_msg where direction = 'O' and attachments = '{image/jpeg:https:///_test_attachments_storage/attachments/1/6929/26ea/692926ea-09d6-4942-bd38-d266ec8d3716}'",
"count": 1
}
]
Expand Down
2 changes: 1 addition & 1 deletion services/tickets/twilioflex/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

func init() {
base := "/mr/tickets/types/twilioflex"
web.RegisterJSONRoute(http.MethodPost, base+"/event_callback/{ticketer:[a-f0-9\\-]+}/{ticket:[a-f0-9\\-]+}", web.WithHTTPLogs(handleEventCallback))
web.RegisterRoute(http.MethodPost, base+"/event_callback/{ticketer:[a-f0-9\\-]+}/{ticket:[a-f0-9\\-]+}", web.MarshaledResponse(web.WithHTTPLogs(handleEventCallback)))
}

type eventCallbackRequest struct {
Expand Down
8 changes: 4 additions & 4 deletions services/tickets/twilioflex/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package twilioflex_test
import (
"testing"
"time"

"github.com/nyaruka/mailroom/testsuite"
"github.com/nyaruka/mailroom/testsuite/testdata"
"github.com/nyaruka/mailroom/web"
)

func TestEventCallback(t *testing.T) {
ctx, rt, db, _ := testsuite.Get()
ctx, rt := testsuite.Runtime()
testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

defer testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

ticket := testdata.InsertOpenTicket(
db,
rt,
testdata.Org1,
testdata.Cathy,
testdata.Twilioflex,
Expand All @@ -26,5 +26,5 @@ func TestEventCallback(t *testing.T) {
testdata.Viewer,
)

web.RunWebTests(t, ctx, rt, "testdata/event_callback.json", map[string]string{"cathy_ticket_uuid": string(ticket.UUID)})
testsuite.RunWebTests(t, ctx, rt, "testdata/event_callback.json", map[string]string{"cathy_ticket_uuid": string(ticket.UUID)})
}
4 changes: 2 additions & 2 deletions services/tickets/wenichats/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

func TestOpenAndForward(t *testing.T) {
ctx, rt, _, _ := testsuite.Get()
ctx, rt := testsuite.Runtime()
testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

defer dates.SetNowSource(dates.DefaultNowSource)
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestOpenAndForward(t *testing.T) {
}

func TestCloseAndReopen(t *testing.T) {
_, rt, _, _ := testsuite.Get()
_, rt := testsuite.Runtime()

defer uuids.SetGenerator(uuids.DefaultGenerator)
defer httpx.SetRequestor(httpx.DefaultRequestor)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
POST /v1/external/rooms/ HTTP/1.1
Host: chats-engine.dev.cloud.weni.ai
User-Agent: Go-http-client/1.1
Content-Length: 583
Content-Length: 532
Authorization: Bearer ****************
Content-Type: application/json
Accept-Encoding: gzip

{"queue_uuid":"5cc1848a-357c-4de9-9720-45770ec18d11","sector_uuid":"1a4bae05-993c-4f3b-91b5-80f4e09951f2","contact":{"external_id":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis","urn":"tel:+12024561111?channel=57f1078f-88aa-46f4-a59a-948a5739c03d","groups":[{"uuid":"b7cf0d83-f1c9-411c-96fd-c511a4cfa86d","name":"Testers"},{"uuid":"4f1f98fc-27a7-4a69-bbdb-24744ba739a9","name":"Males"}]},"custom_fields":{"activation_****************":"AACC55","age":"23","country":"brazil","gender":"Male","join_date":"2017-12-02","mood":"angry"},"flow_uuid":"50c3706e-fedb-42c0-8eab-dda3335714b7"}
{"queue_uuid":"5cc1848a-357c-4de9-9720-45770ec18d11","sector_uuid":"1a4bae05-993c-4f3b-91b5-80f4e09951f2","contact":{"external_id":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis","urn":"tel:+12024561111?channel=57f1078f-88aa-46f4-a59a-948a5739c03d","groups":[{"uuid":"b7cf0d83-f1c9-411c-96fd-c511a4cfa86d","name":"Testers"},{"uuid":"4f1f98fc-27a7-4a69-bbdb-24744ba739a9","name":"Males"}]},"custom_fields":{"activation_****************":"AACC55","age":"23","country":"brazil","gender":"Male","join_date":"2017-12-02","mood":"angry"}}
2 changes: 1 addition & 1 deletion services/tickets/wenichats/testdata/event_callback.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
},
"db_assertions": [
{
"query": "select count(*) from msgs_msg where direction = 'O' and attachments = '{text/plain:https:///_test_media_storage/media/1/6929/26ea/692926ea-09d6-4942-bd38-d266ec8d3716.jpg}'",
"query": "select count(*) from msgs_msg where direction = 'O' and attachments = '{text/plain:https:///_test_attachments_storage/attachments/1/6929/26ea/692926ea-09d6-4942-bd38-d266ec8d3716.jpg}'",
"count": 1
}
]
Expand Down
2 changes: 1 addition & 1 deletion services/tickets/wenichats/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var mediaTypeMaxBodyBytes = map[string]int{

func init() {
base := "/mr/tickets/types/wenichats"
web.RegisterJSONRoute(http.MethodPost, base+"/event_callback/{ticketer:[a-f0-9\\-]+}/{ticket:[a-f0-9\\-]+}", web.WithHTTPLogs(handleEventCallback))
web.RegisterRoute(http.MethodPost, base+"/event_callback/{ticketer:[a-f0-9\\-]+}/{ticket:[a-f0-9\\-]+}", web.MarshaledResponse(web.WithHTTPLogs(handleEventCallback)))
}

type eventCallbackRequest struct {
Expand Down
7 changes: 3 additions & 4 deletions services/tickets/wenichats/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import (

"github.com/nyaruka/mailroom/testsuite"
"github.com/nyaruka/mailroom/testsuite/testdata"
"github.com/nyaruka/mailroom/web"
)

func TestEventCallback(t *testing.T) {
ctx, rt, db, _ := testsuite.Get()
ctx, rt := testsuite.Runtime()
testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

defer testsuite.Reset(testsuite.ResetData | testsuite.ResetStorage)

ticket := testdata.InsertOpenTicket(
db,
rt,
testdata.Org1,
testdata.Cathy,
testdata.Wenichats,
Expand All @@ -27,5 +26,5 @@ func TestEventCallback(t *testing.T) {
nil,
)

web.RunWebTests(t, ctx, rt, "testdata/event_callback.json", map[string]string{"cathy_ticket_uuid": string(ticket.UUID)})
testsuite.RunWebTests(t, ctx, rt, "testdata/event_callback.json", map[string]string{"cathy_ticket_uuid": string(ticket.UUID)})
}

This file was deleted.

Loading

0 comments on commit fe21208

Please sign in to comment.