Skip to content

Commit

Permalink
Merge pull request #366 from sim1s/escalation-level
Browse files Browse the repository at this point in the history
Adding escalation level to ManageIncidentOptions
  • Loading branch information
theckman committed Nov 9, 2021
2 parents ad98290 + 2ff42eb commit 2b775e1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ type ManageIncidentsOptions struct {
Title string `json:"title,omitempty"`
Priority *APIReference `json:"priority,omitempty"`
Assignments []Assignee `json:"assignments,omitempty"`
EscalationLevel uint `json:"escalation_level,omitempty"`
EscalationPolicy *APIReference `json:"escalation_policy,omitempty"`
Resolution string `json:"resolution,omitempty"`
}
Expand Down
36 changes: 36 additions & 0 deletions incident_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,42 @@ func TestIncident_Manage_assignments(t *testing.T) {
testEqual(t, want, res)
}

func TestIncident_Manage_esclation_level(t *testing.T) {
setup()
defer teardown()

mux.HandleFunc("/incidents", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
_, _ = w.Write([]byte(`{"incidents": [{"title": "foo", "id": "1"}]}`))
})
listObj := APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
client := defaultTestClient(server.URL, "foo")
from := "foo@bar.com"

input := []ManageIncidentsOptions{
{
ID: "1",
Type: "incident",
EscalationLevel: 2,
},
}

want := &ListIncidentsResponse{
APIListObject: listObj,
Incidents: []Incident{
{
Id: "1",
Title: "foo",
},
},
}
res, err := client.ManageIncidents(from, input)
if err != nil {
t.Fatal(err)
}
testEqual(t, want, res)
}

func TestIncident_Merge(t *testing.T) {
setup()
defer teardown()
Expand Down

0 comments on commit 2b775e1

Please sign in to comment.