Skip to content

Commit

Permalink
Merge pull request #280 from Ilhasoft/feature/vk-channel
Browse files Browse the repository at this point in the history
Feature/vk channel
  • Loading branch information
nicpottier authored Feb 5, 2020
2 parents a9383a6 + 1ceb095 commit a9fef93
Show file tree
Hide file tree
Showing 6 changed files with 1,079 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/courier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (
_ "github.com/nyaruka/courier/handlers/twiml"
_ "github.com/nyaruka/courier/handlers/twitter"
_ "github.com/nyaruka/courier/handlers/viber"
_ "github.com/nyaruka/courier/handlers/vk"
_ "github.com/nyaruka/courier/handlers/wavy"
_ "github.com/nyaruka/courier/handlers/wechat"
_ "github.com/nyaruka/courier/handlers/whatsapp"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/lib/pq v1.0.0
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.1.0
github.com/nyaruka/gocommon v1.2.0
github.com/nyaruka/librato v1.0.0
github.com/nyaruka/null v1.1.1
github.com/nyaruka/phonenumbers v1.0.44 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ 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.1.0 h1:tMpi1ILtOsClwzmZkUrd6wtK3aDi/WeF9/JmRkp6jkY=
github.com/nyaruka/gocommon v1.1.0/go.mod h1:QbdU2J9WBsqBmeZRuwndf2f6O7rD7mkC0bGn5UNnwjI=
github.com/nyaruka/gocommon v1.2.0 h1:gCmVCXYZFwKDMqQj8R1jNlK+7a06khKFq3zX8fBBbzw=
github.com/nyaruka/gocommon v1.2.0/go.mod h1:9Y21Fd6iZXDLHWTRiZAc6b4LQSCi6HEEQK4SB45Yav4=
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
github.com/nyaruka/librato v1.0.0/go.mod h1:pkRNLFhFurOz0QqBz6/DuTFhHHxAubWxs4Jx+J7yUgg=
github.com/nyaruka/null v1.1.1 h1:kRy1Luj7jUHWEFqc2J6VXrKYi/beLEZdS1C7rA6vqTE=
Expand Down
3 changes: 2 additions & 1 deletion handlers/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type SendPrepFunc func(*httptest.Server, courier.ChannelHandler, courier.Channel
type MockedRequest struct {
Method string
Path string
RawQuery string
Body string
BodyContains string
}
Expand Down Expand Up @@ -219,7 +220,7 @@ func RunChannelSendTestCases(t *testing.T, channel courier.Channel, handler cour
require.Zero(testCase.ResponseBody, "ResponseBody should not be used when using testcase.Responses")
for mockRequest, mockResponse := range testCase.Responses {
bodyStr := string(body)[:]
if mockRequest.Method == r.Method && mockRequest.Path == r.URL.Path && (mockRequest.Body == bodyStr || (mockRequest.BodyContains != "" && strings.Contains(bodyStr, mockRequest.BodyContains))) {
if mockRequest.Method == r.Method && mockRequest.Path == r.URL.Path && mockRequest.RawQuery == r.URL.RawQuery && (mockRequest.Body == bodyStr || (mockRequest.BodyContains != "" && strings.Contains(bodyStr, mockRequest.BodyContains))) {
w.WriteHeader(mockResponse.Status)
w.Write([]byte(mockResponse.Body))
mockRRCount++
Expand Down
Loading

0 comments on commit a9fef93

Please sign in to comment.