Skip to content

Commit

Permalink
Refactor FBA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Apr 8, 2022
1 parent 2d19d67 commit 1eed670
Show file tree
Hide file tree
Showing 35 changed files with 815 additions and 707 deletions.
744 changes: 37 additions & 707 deletions handlers/facebookapp/facebookapp_test.go

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions handlers/facebookapp/testdata/fba/attachmentFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"mid": "external_id",
"attachments": [
{
"type": "image",
"payload": {
"url": "https://image-url/foo.png"
}
}
]
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
24 changes: 24 additions & 0 deletions handlers/facebookapp/testdata/fba/differentPageFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"text": "Hello World",
"mid": "external_id"
},
"recipient": {
"id": "1235"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
27 changes: 27 additions & 0 deletions handlers/facebookapp/testdata/fba/dlr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"delivery": {
"mids": [
"mid.1458668856218:ed81099e15d3f4f233"
],
"watermark": 1458668856253,
"seq": 37
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
43 changes: 43 additions & 0 deletions handlers/facebookapp/testdata/fba/duplicateMsgFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"text": "Hello World",
"mid": "external_id"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
},
{
"id": "12345",
"messaging": [
{
"message": {
"text": "Hello World",
"mid": "external_id"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
23 changes: 23 additions & 0 deletions handlers/facebookapp/testdata/fba/echoFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970,
"message": {
"is_echo": true,
"mid": "qT7ywaK"
}
}
]
}
]
}
24 changes: 24 additions & 0 deletions handlers/facebookapp/testdata/fba/helloMsgFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"text": "Hello World",
"mid": "external_id"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
24 changes: 24 additions & 0 deletions handlers/facebookapp/testdata/fba/invalidURNFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"text": "Hello World",
"mid": "external_id"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "abc5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
34 changes: 34 additions & 0 deletions handlers/facebookapp/testdata/fba/locationAttachment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"message": {
"mid": "external_id",
"attachments": [
{
"type": "location",
"payload": {
"coordinates": {
"lat": 1.2,
"long": -1.3
}
}
}
]
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
4 changes: 4 additions & 0 deletions handlers/facebookapp/testdata/fba/noEntriesFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"object": "page",
"entry": []
}
8 changes: 8 additions & 0 deletions handlers/facebookapp/testdata/fba/noMessagingEntriesFBA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"object": "page",
"entry": [
{
"id": "12345"
}
]
}
6 changes: 6 additions & 0 deletions handlers/facebookapp/testdata/fba/notPage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"object": "notpage",
"entry": [
{}
]
}
23 changes: 23 additions & 0 deletions handlers/facebookapp/testdata/fba/optIn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"optin": {
"ref": "optin_ref"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
24 changes: 24 additions & 0 deletions handlers/facebookapp/testdata/fba/optInUserRef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"optin": {
"ref": "optin_ref",
"user_ref": "optin_user_ref"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
29 changes: 29 additions & 0 deletions handlers/facebookapp/testdata/fba/postback.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"postback": {
"title": "postback title",
"payload": "postback payload",
"referral": {
"ref": "postback ref",
"source": "postback source",
"type": "postback type"
}
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
24 changes: 24 additions & 0 deletions handlers/facebookapp/testdata/fba/postbackGetStarted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"object": "page",
"entry": [
{
"id": "12345",
"messaging": [
{
"postback": {
"title": "postback title",
"payload": "get_started"
},
"recipient": {
"id": "12345"
},
"sender": {
"id": "5678"
},
"timestamp": 1459991487970
}
],
"time": 1459991487970
}
]
}
Loading

0 comments on commit 1eed670

Please sign in to comment.