Skip to content

Commit

Permalink
Add mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Dec 10, 2024
1 parent 6729037 commit 57cc750
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/handlers/ticket_opened_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func TestTicketOpened(t *testing.T) {
"https://nyaruka.zendesk.com/api/v2/users/search.json?query=b699a406-7e44-49be-9f01-1a82893e8a10": {
httpx.NewMockResponse(200, nil, `{"users": []}`),
},
"https://nyaruka.zendesk.com/api/v2/users/search.json?query=type:user details:\"b699a406-7e44-49be-9f01-1a82893e8a10\"": {
httpx.NewMockResponse(200, nil, `{"users": [{"id": 35241, "name": "Dummy User"}], "count": 1, "next_page": "https://nyaruka.zendesk.com/api/v2/users.json?page=2"}`),
},
"https://nyaruka.zendesk.com/api/v2/users/35241/merge": {
httpx.NewMockResponse(200, nil, `{"users": [{"id": 35241, "name": "Dummy User"}], "count": 1, "next_page": "https://nyaruka.zendesk.com/api/v2/users.json?page=2"}`),
},
"https://nyaruka.zendesk.com/api/v2/users.json": {
httpx.NewMockResponse(201, nil, `{
"user": {
Expand Down Expand Up @@ -110,7 +116,7 @@ func TestTicketOpened(t *testing.T) {
{ // and there's an HTTP log for that
SQL: "select count(*) from request_logs_httplog where ticketer_id = $1",
Args: []interface{}{testdata.Zendesk.ID},
Count: 3,
Count: 5,
},
{ // which doesn't include our API token
SQL: "select count(*) from request_logs_httplog where ticketer_id = $1 AND request like '%523562%'",
Expand Down

0 comments on commit 57cc750

Please sign in to comment.