-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from abebars/handle-ticket-via
Handle Via field in Ticket
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ package zendesk | |
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
"reflect" | ||
"sort" | ||
"testing" | ||
) | ||
|
@@ -45,6 +47,36 @@ func TestGetTicket(t *testing.T) { | |
if ticket.ID != expectedID { | ||
t.Fatalf("Returned ticket does not have the expected ID %d. Ticket id is %d", expectedID, ticket.ID) | ||
} | ||
|
||
expectedVia := struct { | ||
Channel string `json:"channel"` | ||
Source struct { | ||
From map[string]interface{} `json:"from"` | ||
To map[string]interface{} `json:"to"` | ||
Rel string `json:"rel"` | ||
} `json:"source"` | ||
}{ | ||
Channel: "email", | ||
Source: struct { | ||
From map[string]interface{} `json:"from"` | ||
To map[string]interface{} `json:"to"` | ||
Rel string `json:"rel"` | ||
}{ | ||
From: map[string]interface{}{ | ||
"address": "[email protected]", | ||
"name": "Yosuke Tamura", | ||
}, | ||
To: map[string]interface{}{ | ||
"name": "Terraform Zendesk provider", | ||
"address": "[email protected]", | ||
}, | ||
Rel: "", | ||
}, | ||
} | ||
|
||
if !reflect.DeepEqual(ticket.Via, expectedVia) { | ||
t.Fatal(fmt.Sprintf("Expected ticket via object to be %v but got %v", expectedVia, ticket.Via)) | ||
} | ||
} | ||
|
||
func TestGetTicketCanceledContext(t *testing.T) { | ||
|