Skip to content

Commit

Permalink
Add test for ticket modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jul 18, 2022
1 parent e188853 commit 460fc31
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testsuite/testdata/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var DefaultTopic = &Topic{1, "5cc1848a-357c-4de9-9720-45770ec18d11"}
var SalesTopic = &Topic{2, "9ef2ff21-064a-41f1-8560-ccc990b4f937"}
var SupportTopic = &Topic{3, "0a8f2e00-fef6-402c-bd79-d789446ec0e0"}

var Internal = &Ticketer{1, "8bd48029-6ca1-46a8-aa14-68f7213b82b3"}
var Internal = &Ticketer{1, "ffc903f7-8cbb-443f-9627-87106842d1aa"}
var Mailgun = &Ticketer{2, "f9c9447f-a291-4f3c-8c79-c089bbd4e713"}
var Zendesk = &Ticketer{3, "4ee6d4f3-f92b-439b-9718-8da90c05490b"}
var RocketChat = &Ticketer{4, "6c50665f-b4ff-4e37-9625-bc464fe6a999"}
Expand Down
1 change: 1 addition & 0 deletions web/contact/contact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

_ "github.com/nyaruka/mailroom/core/handlers"
"github.com/nyaruka/mailroom/core/models"
_ "github.com/nyaruka/mailroom/services/tickets/intern"
"github.com/nyaruka/mailroom/testsuite"
"github.com/nyaruka/mailroom/testsuite/testdata"
"github.com/nyaruka/mailroom/web"
Expand Down
121 changes: 121 additions & 0 deletions web/contact/testdata/modify.json
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,105 @@
}
]
},
{
"label": "open ticket",
"method": "POST",
"path": "/mr/contact/modify",
"body": {
"org_id": 1,
"user_id": 3,
"contact_ids": [
10000
],
"modifiers": [
{
"type": "ticket",
"ticketer": {
"uuid": "ffc903f7-8cbb-443f-9627-87106842d1aa",
"name": "RapidPro Tickets"
},
"topic": {
"uuid": "0a8f2e00-fef6-402c-bd79-d789446ec0e0",
"name": "Support"
},
"body": "Need help",
"assignee": {
"email": "admin1@nyaruka.com",
"name": "Andy Admin"
}
}
]
},
"status": 200,
"response": {
"10000": {
"contact": {
"created_on": "2018-07-06T12:30:00.123457Z",
"groups": [
{
"name": "Open Tickets",
"uuid": "361838c4-2866-495a-8990-9f3c222a7604"
}
],
"id": 10000,
"language": "fra",
"status": "active",
"tickets": [
{
"assignee": {
"email": "admin1@nyaruka.com",
"name": "Andy Admin"
},
"body": "Need help",
"ticketer": {
"name": "RapidPro Tickets",
"uuid": "ffc903f7-8cbb-443f-9627-87106842d1aa"
},
"topic": {
"name": "Support",
"uuid": "0a8f2e00-fef6-402c-bd79-d789446ec0e0"
},
"uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5"
}
],
"timezone": "America/Los_Angeles",
"uuid": "6393abc0-283d-4c9b-a1b3-641a035c34bf"
},
"events": [
{
"created_on": "2018-07-06T12:30:00.123456789Z",
"ticket": {
"assignee": {
"email": "admin1@nyaruka.com",
"name": "Andy Admin"
},
"body": "Need help",
"ticketer": {
"name": "RapidPro Tickets",
"uuid": "ffc903f7-8cbb-443f-9627-87106842d1aa"
},
"topic": {
"name": "Support",
"uuid": "0a8f2e00-fef6-402c-bd79-d789446ec0e0"
},
"uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5"
},
"type": "ticket_opened"
},
{
"created_on": "2018-07-06T12:30:01.123456789Z",
"groups_added": [
{
"name": "Open Tickets",
"uuid": "361838c4-2866-495a-8990-9f3c222a7604"
}
],
"type": "contact_groups_changed"
}
]
}
}
},
{
"label": "multiple modifiers of different types",
"method": "POST",
Expand Down Expand Up @@ -1350,12 +1449,34 @@
"name": "Juan",
"language": "spa",
"status": "active",
"tickets": [
{
"assignee": {
"email": "admin1@nyaruka.com",
"name": "Andy Admin"
},
"body": "Need help",
"ticketer": {
"name": "RapidPro Tickets",
"uuid": "ffc903f7-8cbb-443f-9627-87106842d1aa"
},
"topic": {
"name": "Support",
"uuid": "0a8f2e00-fef6-402c-bd79-d789446ec0e0"
},
"uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5"
}
],
"timezone": "America/Los_Angeles",
"created_on": "2018-07-06T12:30:00.123457Z",
"urns": [
"tel:+255788555111"
],
"groups": [
{
"name": "Open Tickets",
"uuid": "361838c4-2866-495a-8990-9f3c222a7604"
},
{
"uuid": "5e9d8fab-5e7e-4f51-b533-261af5dea70d",
"name": "Testers"
Expand Down

0 comments on commit 460fc31

Please # to comment.