Skip to content

Commit

Permalink
tweak whatsapp test
Browse files Browse the repository at this point in the history
  • Loading branch information
rasoro committed Apr 25, 2022
1 parent b6ec19f commit 373fd00
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions handlers/whatsapp/whatsapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,19 @@ var defaultSendTestCases = []ChannelSendTestCase{
{Label: "Link Sending",
Text: "Link Sending https://link.com", URN: "whatsapp:250788123123", Path: "/v1/messages",
Status: "W", ExternalID: "157b5e14568e8",
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
RequestBody: `{"to":"250788123123","type":"text","preview_url":true,"text":{"body":"Link Sending https://link.com"}}`,
SendPrep: setSendURL},
{Label: "Plain Send",
Text: "Simple Message", URN: "whatsapp:250788123123", Path: "/v1/messages",
Status: "W", ExternalID: "157b5e14568e8",
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
RequestBody: `{"to":"250788123123","type":"text","text":{"body":"Simple Message"}}`,
SendPrep: setSendURL},
{Label: "Unicode Send",
Text: "☺", URN: "whatsapp:250788123123",
Status: "W", ExternalID: "157b5e14568e8",
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
RequestBody: `{"to":"250788123123","type":"text","text":{"body":"☺"}}`,
SendPrep: setSendURL},
{Label: "Error",
Expand Down Expand Up @@ -424,7 +424,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"audio","audio":{"link":"https://foo.bar/audio.mp3"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -441,7 +441,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"document","document":{"link":"https://foo.bar/document.pdf","caption":"document caption","filename":"document.pdf"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -458,7 +458,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"image","image":{"link":"https://foo.bar/image.jpg","caption":"document caption"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -475,7 +475,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"video","video":{"link":"https://foo.bar/video.mp4","caption":"video caption"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -485,7 +485,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
URN: "whatsapp:250788123123",
Status: "W", ExternalID: "157b5e14568e8",
Metadata: json.RawMessage(`{ "templating": { "template": { "name": "revive_issue", "uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3" }, "language": "eng", "variables": ["Chef", "tomorrow"]}}`),
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
RequestBody: `{"to":"250788123123","type":"template","template":{"namespace":"waba_namespace","name":"revive_issue","language":{"policy":"deterministic","code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
SendPrep: setSendURL,
},
Expand All @@ -494,7 +494,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
URN: "whatsapp:250788123123",
Status: "W", ExternalID: "157b5e14568e8",
Metadata: json.RawMessage(`{ "templating": { "template": { "name": "revive_issue", "uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3" }, "language": "eng", "country": "US", "variables": ["Chef", "tomorrow"]}}`),
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
RequestBody: `{"to":"250788123123","type":"template","template":{"namespace":"waba_namespace","name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
SendPrep: setSendURL,
},
Expand All @@ -503,7 +503,7 @@ var defaultSendTestCases = []ChannelSendTestCase{
URN: "whatsapp:250788123123",
Status: "W", ExternalID: "157b5e14568e8",
Metadata: json.RawMessage(`{ "templating": { "template": { "name": "revive_issue", "uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3" }, "namespace": "wa_template_namespace", "language": "eng", "country": "US", "variables": ["Chef", "tomorrow"]}}`),
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
RequestBody: `{"to":"250788123123","type":"template","template":{"namespace":"wa_template_namespace","name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
SendPrep: setSendURL,
},
Expand Down Expand Up @@ -634,13 +634,13 @@ var defaultSendTestCases = []ChannelSendTestCase{
{Label: "Interactive Button Message Send",
Text: "Interactive Button Msg", URN: "whatsapp:250788123123", QuickReplies: []string{"BUTTON1"},
Status: "W", ExternalID: "157b5e14568e8",
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
RequestBody: `{"to":"250788123123","type":"interactive","interactive":{"type":"button","body":{"text":"Interactive Button Msg"},"action":{"buttons":[{"type":"reply","reply":{"id":"0","title":"BUTTON1"}}]}}}`,
SendPrep: setSendURL},
{Label: "Interactive List Message Send",
Text: "Interactive List Msg", URN: "whatsapp:250788123123", QuickReplies: []string{"ROW1", "ROW2", "ROW3", "ROW4"},
Status: "W", ExternalID: "157b5e14568e8",
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 201,
RequestBody: `{"to":"250788123123","type":"interactive","interactive":{"type":"list","body":{"text":"Interactive List Msg"},"action":{"button":"Menu","sections":[{"rows":[{"id":"0","title":"ROW1"},{"id":"1","title":"ROW2"},{"id":"2","title":"ROW3"},{"id":"3","title":"ROW4"}]}]}}}`,
SendPrep: setSendURL},
{Label: "Interactive Button Message Send with attachment",
Expand Down Expand Up @@ -719,7 +719,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
BodyContains: `/document.pdf`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -736,7 +736,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
BodyContains: `/document.pdf`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -761,7 +761,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"video","video":{"id":"36c484d1-1283-4b94-988d-7276bdec4de2","caption":"video caption"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -778,7 +778,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"video","video":{"id":"36c484d1-1283-4b94-988d-7276bdec4de2","caption":"video caption"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -804,7 +804,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"document","document":{"id":"25c484d1-1283-4b94-988d-7276bdec4ef3","caption":"document caption","filename":"document2.pdf"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -821,7 +821,7 @@ var mediaCacheSendTestCases = []ChannelSendTestCase{
Body: `{"to":"250788123123","type":"document","document":{"id":"25c484d1-1283-4b94-988d-7276bdec4ef3","caption":"document caption","filename":"document2.pdf"}}`,
}: MockedResponse{
Status: 201,
Body: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`,
Body: `{ "messages": [{"id": "157b5e14568e8"}] }`,
},
},
SendPrep: setSendURL,
Expand All @@ -834,7 +834,7 @@ var hsmSupportSendTestCases = []ChannelSendTestCase{
URN: "whatsapp:250788123123",
Status: "W", ExternalID: "157b5e14568e8",
Metadata: json.RawMessage(`{ "templating": { "template": { "name": "revive_issue", "uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3" }, "language": "eng", "variables": ["Chef", "tomorrow"]}}`),
ResponseBody: `{ "contacts":[{"input":"250788123123","wa_id":"250788123123"}], "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
ResponseBody: `{ "messages": [{"id": "157b5e14568e8"}] }`, ResponseStatus: 200,
RequestBody: `{"to":"250788123123","type":"hsm","hsm":{"namespace":"waba_namespace","element_name":"revive_issue","language":{"policy":"deterministic","code":"en"},"localizable_params":[{"default":"Chef"},{"default":"tomorrow"}]}}`,
SendPrep: setSendURL,
},
Expand Down

0 comments on commit 373fd00

Please sign in to comment.