Skip to content

Commit

Permalink
Maybe fix intermittently failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jun 9, 2020
1 parent 87c02c9 commit f587102
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion services/tickets/zendesk/service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package zendesk

import (
"encoding/json"
"fmt"
"net/http"

Expand Down Expand Up @@ -67,7 +68,10 @@ func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, tickete
triggerID: triggerID,
}, nil
}
return nil, errors.New("missing subdomain or secret or oauth_token or push_id or push_token in zendesk config")

marshaled, _ := json.Marshal(config)

return nil, errors.Errorf("missing subdomain or secret or oauth_token or push_id or push_token in zendesk config: %s", marshaled)
}

// Open opens a ticket which for mailgun means just sending an initial email
Expand Down
4 changes: 4 additions & 0 deletions services/tickets/zendesk/testdata/event_callback.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
{
"query": "select count(*) from tickets_ticketer where config @> '{\"target_id\": \"15\", \"trigger_id\": \"23\"}'",
"count": 0
},
{
"query": "select count(*) from tickets_ticketer where config @> '{\"subdomain\": \"nyaruka\", \"oauth_token\": \"754845822\", \"secret\": \"sesame\"}'",
"count": 1
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions services/tickets/zendesk/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

func TestChannelback(t *testing.T) {
models.FlushCache()
testsuite.Reset()
db := testsuite.DB()

Expand All @@ -20,6 +21,7 @@ func TestChannelback(t *testing.T) {
}

func TestEventCallback(t *testing.T) {
models.FlushCache()
testsuite.Reset()
db := testsuite.DB()

Expand All @@ -31,6 +33,7 @@ func TestEventCallback(t *testing.T) {
}

func TestTarget(t *testing.T) {
models.FlushCache()
testsuite.Reset()
db := testsuite.DB()

Expand Down

0 comments on commit f587102

Please sign in to comment.