Repository: PagerDuty/go-pagerduty
Pull request #227 (2020-06-05 01:35:13)

update changelog for v1.2.0
Also making test output verbose and fixed the name of a test. 


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index bd19887..615769b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,7 +2,7 @@ version: 2
 jobs:
   build:
     docker:
-      - image: circleci/golang:1.14
+      - image: circleci/golang:1.12
     steps:
       - checkout
       - run:
@@ -10,4 +10,4 @@ jobs:
           command: make test
       - run:
           name: "Build"
-          command: make build
+          command: make build
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4e2a01..de15dc6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,33 @@
 # Changelog
 
+## [v1.2.0](https://github.com/PagerDuty/go-pagerduty/tree/v1.2.0) (2020-06-04)
+
+[Full Changelog](https://github.com/PagerDuty/go-pagerduty/compare/v1.1.2...v1.2.0)
+
+**Closed issues:**
+
+- Allowing custom API endpoint in NewClient config [\#198](https://github.com/PagerDuty/go-pagerduty/issues/198)
+- service: SupportHours creation not supported [\#188](https://github.com/PagerDuty/go-pagerduty/issues/188)
+- The "Channel" field doesn't expose all possible data fields [\#153](https://github.com/PagerDuty/go-pagerduty/issues/153)
+
+**Merged pull requests:**
+
+- Adding Rulesets and Ruleset Rules [\#226](https://github.com/PagerDuty/go-pagerduty/pull/226) ([stmcallister](https://github.com/stmcallister))
+- Fix UpdateService [\#220](https://github.com/PagerDuty/go-pagerduty/pull/220) ([n-apalm](https://github.com/n-apalm))
+- Add support for modifying an incident status and assignees [\#219](https://github.com/PagerDuty/go-pagerduty/pull/219) ([raidancampbell](https://github.com/raidancampbell))
+- This should be requester\_id according to pagerduty docs [\#217](https://github.com/PagerDuty/go-pagerduty/pull/217) ([michael-bud](https://github.com/michael-bud))
+- adding since and until to incident logentry options [\#216](https://github.com/PagerDuty/go-pagerduty/pull/216) ([stmcallister](https://github.com/stmcallister))
+- User notification rules [\#215](https://github.com/PagerDuty/go-pagerduty/pull/215) ([heimweh](https://github.com/heimweh))
+- List incident alerts [\#214](https://github.com/PagerDuty/go-pagerduty/pull/214) ([kilianw](https://github.com/kilianw))
+- Bump golang to v1.14 [\#212](https://github.com/PagerDuty/go-pagerduty/pull/212) ([chenrui333](https://github.com/chenrui333))
+- adding NewClientWithAPIEndpoint function [\#210](https://github.com/PagerDuty/go-pagerduty/pull/210) ([stmcallister](https://github.com/stmcallister))
+- Webhook conforms to v2 struct [\#209](https://github.com/PagerDuty/go-pagerduty/pull/209) ([nbutton23](https://github.com/nbutton23))
+- Add Teams to Schedule [\#208](https://github.com/PagerDuty/go-pagerduty/pull/208) ([miekg](https://github.com/miekg))
+- adding Raw to LogEntry.Channel object [\#207](https://github.com/PagerDuty/go-pagerduty/pull/207) ([stmcallister](https://github.com/stmcallister))
+- Updating the Version constant to v1.1.2 [\#206](https://github.com/PagerDuty/go-pagerduty/pull/206) ([stmcallister](https://github.com/stmcallister))
+- updating changelog to v1.1.2 [\#205](https://github.com/PagerDuty/go-pagerduty/pull/205) ([stmcallister](https://github.com/stmcallister))
+- Adding OAuth token support [\#203](https://github.com/PagerDuty/go-pagerduty/pull/203) ([chrisforrette](https://github.com/chrisforrette))
+
 ## [v1.1.2](https://github.com/PagerDuty/go-pagerduty/tree/v1.1.2) (2020-02-21)
 
 [Full Changelog](https://github.com/PagerDuty/go-pagerduty/compare/1.1.1...v1.1.2)
@@ -41,7 +69,6 @@
 - Add support for extensions/extension schemas [\#193](https://github.com/PagerDuty/go-pagerduty/pull/193) ([heimweh](https://github.com/heimweh))
 - Added AlertGrouping and AlertGroupingTimeout to Service [\#189](https://github.com/PagerDuty/go-pagerduty/pull/189) ([toneill818](https://github.com/toneill818))
 - Adds oncall to escalation policy [\#183](https://github.com/PagerDuty/go-pagerduty/pull/183) ([ewilde](https://github.com/ewilde))
-- client: allow overriding the api endpoint [\#173](https://github.com/PagerDuty/go-pagerduty/pull/173) ([heimweh](https://github.com/heimweh))
 - Add ContactMethods operations [\#169](https://github.com/PagerDuty/go-pagerduty/pull/169) ([timlittle](https://github.com/timlittle))
 - return http code with errors [\#134](https://github.com/PagerDuty/go-pagerduty/pull/134) ([yomashExpel](https://github.com/yomashExpel))
 
@@ -71,6 +98,7 @@
 
 - Tests [\#190](https://github.com/PagerDuty/go-pagerduty/pull/190) ([stmcallister](https://github.com/stmcallister))
 - Modify ListOverrides and add ListOverridesResponse [\#185](https://github.com/PagerDuty/go-pagerduty/pull/185) ([dstevensio](https://github.com/dstevensio))
+- client: allow overriding the api endpoint [\#173](https://github.com/PagerDuty/go-pagerduty/pull/173) ([heimweh](https://github.com/heimweh))
 - Change makefiles and readme [\#172](https://github.com/PagerDuty/go-pagerduty/pull/172) ([dineshba](https://github.com/dineshba))
 - Use Go modules [\#168](https://github.com/PagerDuty/go-pagerduty/pull/168) ([nbutton23](https://github.com/nbutton23))
 - escalation\_policy: support clearing teams from an existing escalation policy [\#167](https://github.com/PagerDuty/go-pagerduty/pull/167) ([heimweh](https://github.com/heimweh))
diff --git a/Makefile b/Makefile
index 9846720..fe4adf9 100644
--- a/Makefile
+++ b/Makefile
@@ -9,23 +9,24 @@
 # 	go build -o $(BINARY) command/*
 
 .PHONY: build
+
+GOPATH?=$(shell go env GOPATH)
+GO111MODULE=auto
+
 build: build-deps
 	go build -mod=vendor -o pd ./command
-
-.PHONY: build-deps
 build-deps:
 	go get
 	go mod verify
 	go mod vendor
 
-.PHONY: install
 install: build
-	cp pd $(GOROOT)/bin
+	cp pd $(GOPATH)/bin
 
 .PHONY: test
 test:
-	go test ./...
+	go test -v ./...
 
-.PHONY: deploy
 deploy:
 	- curl -sL https://git.io/goreleaser | bash
+
diff --git a/go.mod b/go.mod
index 7b9c802..017ff18 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/PagerDuty/go-pagerduty
 
-go 1.14
+go 1.12
 
 require (
 	github.com/google/go-querystring v1.0.0
diff --git a/incident.go b/incident.go
index d37ba2a..75da7e6 100644
--- a/incident.go
+++ b/incident.go
@@ -139,11 +139,9 @@ type CreateIncidentOptions struct {
 
 // ManageIncidentsOptions is the structure used when PUTing updates to incidents to the ManageIncidents func
 type ManageIncidentsOptions struct {
-	ID          string        `json:"id"`
-	Type        string        `json:"type"`
-	Status      string        `json:"status,omitempty"`
-	Priority    *APIReference `json:"priority,omitempty"`
-	Assignments []Assignee    `json:"assignments,omitempty"`
+	ID     string `json:"id"`
+	Type   string `json:"type"`
+	Status string `json:"status"`
 }
 
 // MergeIncidentsOptions is the structure used when merging incidents with MergeIncidents func
@@ -269,26 +267,9 @@ type ListAlertsResponse struct {
 	Alerts []IncidentAlert `json:"alerts,omitempty"`
 }
 
-// ListIncidentAlertsOptions is the structure used when passing parameters to the ListIncidentAlerts API endpoint.
-type ListIncidentAlertsOptions struct {
-	APIListObject
-	Statuses []string `url:"statuses,omitempty,brackets"`
-	SortBy   string   `url:"sort_by,omitempty"`
-	Includes []string `url:"include,omitempty,brackets"`
-}
-
 // ListIncidentAlerts lists existing alerts for the specified incident.
 func (c *Client) ListIncidentAlerts(id string) (*ListAlertsResponse, error) {
-	return c.ListIncidentAlertsWithOpts(id, ListIncidentAlertsOptions{})
-}
-
-// ListIncidentAlertsWithOpts lists existing alerts for the specified incident.
-func (c *Client) ListIncidentAlertsWithOpts(id string, o ListIncidentAlertsOptions) (*ListAlertsResponse, error) {
-	v, err := query.Values(o)
-	if err != nil {
-		return nil, err
-	}
-	resp, err := c.get("/incidents/" + id + "/alerts?" + v.Encode())
+	resp, err := c.get("/incidents/" + id + "/alerts")
 	if err != nil {
 		return nil, err
 	}
@@ -368,8 +349,6 @@ type ListIncidentLogEntriesOptions struct {
 	Includes   []string `url:"include,omitempty,brackets"`
 	IsOverview bool     `url:"is_overview,omitempty"`
 	TimeZone   string   `url:"time_zone,omitempty"`
-	Since      string   `url:since,omitempty`
-	Until      string   `url:until,omitempty`
 }
 
 // ListIncidentLogEntries lists existing log entries for the specified incident.
@@ -432,7 +411,7 @@ type ResponderRequestTargets struct {
 type ResponderRequestOptions struct {
 	From        string                   `json:"-"`
 	Message     string                   `json:"message"`
-	RequesterID string                   `json:"requester_id"`
+	RequesterID string                   `json:"request_id"`
 	Targets     []ResponderRequestTarget `json:"responder_request_targets"`
 }
 
diff --git a/schedule.go b/schedule.go
index 5851029..ea40fc4 100644
--- a/schedule.go
+++ b/schedule.go
@@ -44,7 +44,6 @@ type Schedule struct {
 	Description         string          `json:"description,omitempty"`
 	EscalationPolicies  []APIObject     `json:"escalation_policies,omitempty"`
 	Users               []APIObject     `json:"users,omitempty"`
-	Teams               []APIReference  `json:"teams,omitempty"`
 	ScheduleLayers      []ScheduleLayer `json:"schedule_layers,omitempty"`
 	OverrideSubschedule ScheduleLayer   `json:"override_subschedule,omitempty"`
 	FinalSchedule       ScheduleLayer   `json:"final_schedule,omitempty"`
diff --git a/service.go b/service.go
index 266436d..675077b 100644
--- a/service.go
+++ b/service.go
@@ -128,12 +128,7 @@ func (c *Client) CreateService(s Service) (*Service, error) {
 
 // UpdateService updates an existing service.
 func (c *Client) UpdateService(s Service) (*Service, error) {
-	body := struct {
-		Service `json:"service,omitempty"`
-	}{
-		s,
-	}
-	resp, err := c.put("/services/"+s.ID, body, nil)
+	resp, err := c.put("/services/"+s.ID, s, nil)
 	return getServiceFromResponse(c, resp, err)
 }
 
diff --git a/user.go b/user.go
index ed2a174..b3cebc7 100644
--- a/user.go
+++ b/user.go
@@ -72,12 +72,6 @@ type ListContactMethodsResponse struct {
 	ContactMethods []ContactMethod `json:"contact_methods"`
 }
 
-// ListUserNotificationRulesResponse the data structure returned from calling the ListNotificationRules API endpoint.
-type ListUserNotificationRulesResponse struct {
-	APIListObject
-	NotificationRules []NotificationRule `json:"notification_rules"`
-}
-
 // GetUserOptions is the data structure used when calling the GetUser API endpoint.
 type GetUserOptions struct {
 	Includes []string `url:"include,omitempty,brackets"`
@@ -85,7 +79,7 @@ type GetUserOptions struct {
 
 // GetCurrentUserOptions is the data structure used when calling the GetCurrentUser API endpoint.
 type GetCurrentUserOptions struct {
-	Includes []string `url:"include,omitempty,brackets"`
+	Includes [] string `url:"include,omitempty,brackets"`
 }
 
 // ListUsers lists users of your PagerDuty account, optionally filtered by a search query.
@@ -213,57 +207,3 @@ func getContactMethodFromResponse(c *Client, resp *http.Response, err error) (*C
 	}
 	return &t, nil
 }
-
-// GetUserNotificationRule gets details about a notification rule.
-func (c *Client) GetUserNotificationRule(userID, ruleID string) (*NotificationRule, error) {
-	resp, err := c.get("/users/" + userID + "/notification_rules/" + ruleID)
-	return getUserNotificationRuleFromResponse(c, resp, err)
-}
-
-// CreateUserNotificationRule creates a new notification rule for a user.
-func (c *Client) CreateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error) {
-	data := make(map[string]NotificationRule)
-	data["notification_rule"] = rule
-	resp, err := c.post("/users/"+userID+"/notification_rules", data, nil)
-	return getUserNotificationRuleFromResponse(c, resp, err)
-}
-
-// UpdateUserNotificationRule updates a notification rule for a user.
-func (c *Client) UpdateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error) {
-	data := make(map[string]NotificationRule)
-	data["notification_rule"] = rule
-	resp, err := c.put("/users/"+userID+"/notification_rules/"+rule.ID, data, nil)
-	return getUserNotificationRuleFromResponse(c, resp, err)
-}
-
-// DeleteUserNotificationRule deletes a notification rule for a user.
-func (c *Client) DeleteUserNotificationRule(userID, ruleID string) error {
-	_, err := c.delete("/users/" + userID + "/notification_rules/" + ruleID)
-	return err
-}
-
-// ListUserNotificationRules fetches notification rules of the existing user.
-func (c *Client) ListUserNotificationRules(userID string) (*ListUserNotificationRulesResponse, error) {
-	resp, err := c.get("/users/" + userID + "/notification_rules")
-	if err != nil {
-		return nil, err
-	}
-	var result ListUserNotificationRulesResponse
-	return &result, c.decodeJSON(resp, &result)
-}
-
-func getUserNotificationRuleFromResponse(c *Client, resp *http.Response, err error) (*NotificationRule, error) {
-	if err != nil {
-		return nil, err
-	}
-	var target map[string]NotificationRule
-	if dErr := c.decodeJSON(resp, &target); dErr != nil {
-		return nil, fmt.Errorf("Could not decode JSON response: %v", dErr)
-	}
-	rootNode := "notification_rule"
-	t, nodeOK := target[rootNode]
-	if !nodeOK {
-		return nil, fmt.Errorf("JSON response does not have %s field", rootNode)
-	}
-	return &t, nil
-}


Test patch:
diff --git a/incident_test.go b/incident_test.go
index 5eac9da..4b206ca 100644
--- a/incident_test.go
+++ b/incident_test.go
@@ -64,7 +64,7 @@ func TestIncident_Create(t *testing.T) {
 	testEqual(t, want, res)
 }
 
-func TestIncident_Manage_status(t *testing.T) {
+func TestIncident_Manage(t *testing.T) {
 	setup()
 	defer teardown()
 
@@ -102,116 +102,6 @@ func TestIncident_Manage_status(t *testing.T) {
 	testEqual(t, want, res)
 }
 
-func TestIncident_Manage_priority(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", "priority": {"id": "PRIORITY_ID_HERE", "type": "priority_reference"}}]}`))
-	})
-	var listObj = APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	from := "foo@bar.com"
-
-	input := []ManageIncidentsOptions{
-		{
-			ID:   "1",
-			Type: "incident",
-			Priority: &APIReference{
-				ID:   "PRIORITY_ID_HERE",
-				Type: "priority_reference",
-			},
-		},
-	}
-
-	want := &ListIncidentsResponse{
-		APIListObject: listObj,
-		Incidents: []Incident{
-			{
-				Id:    "1",
-				Title: "foo",
-				Priority: &Priority{
-					APIObject: APIObject{
-						ID:   "PRIORITY_ID_HERE",
-						Type: "priority_reference",
-					},
-				},
-			},
-		},
-	}
-	res, err := client.ManageIncidents(from, input)
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
-func TestIncident_Manage_assignments(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", "assignments": [{"assignee":{"id": "ASSIGNEE_ONE", "type": "user_reference"}},{"assignee":{"id": "ASSIGNEE_TWO", "type": "user_reference"}}]}]}`))
-	})
-	var listObj = APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	from := "foo@bar.com"
-
-	input := []ManageIncidentsOptions{
-		{
-			ID:   "1",
-			Type: "incident",
-			Assignments: []Assignee{
-				{
-					Assignee: APIObject{
-						ID:   "ASSIGNEE_ONE",
-						Type: "user_reference",
-					},
-				},
-				{
-					Assignee: APIObject{
-						ID:   "ASSIGNEE_TWO",
-						Type: "user_reference",
-					},
-				},
-			},
-		},
-	}
-
-	want := &ListIncidentsResponse{
-		APIListObject: listObj,
-		Incidents: []Incident{
-			{
-				Id:    "1",
-				Title: "foo",
-				Assignments: []Assignment{
-					{
-						Assignee: APIObject{
-							ID:   "ASSIGNEE_ONE",
-							Type: "user_reference",
-						},
-					},
-					{
-						Assignee: APIObject{
-							ID:   "ASSIGNEE_TWO",
-							Type: "user_reference",
-						},
-					},
-				},
-			},
-		},
-	}
-	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()
@@ -313,42 +203,6 @@ func TestIncident_ListIncidentAlerts(t *testing.T) {
 	}
 	testEqual(t, want, res)
 }
-func TestIncident_ListIncidentAlertsWithOpts(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/incidents/1/alerts", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "GET")
-		w.Write([]byte(`{"alerts": [{"id": "1","summary":"foo"}]}`))
-	})
-	var listObj = APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	id := "1"
-
-	var alertOpts = ListIncidentAlertsOptions{
-		APIListObject: listObj,
-		Includes:      []string{},
-	}
-
-	res, err := client.ListIncidentAlertsWithOpts(id, alertOpts)
-
-	want := &ListAlertsResponse{
-		APIListObject: listObj,
-		Alerts: []IncidentAlert{
-			{
-				APIObject: APIObject{
-					ID:      "1",
-					Summary: "foo",
-				},
-			},
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
 
 // CreateIncidentNote
 func TestIncident_CreateIncidentNote(t *testing.T) {
@@ -488,46 +342,6 @@ func TestIncident_ListLogEntries(t *testing.T) {
 	testEqual(t, want, res)
 }
 
-// ListIncidentLogEntriesSinceUntil
-func TestIncident_ListLogEntriesSinceUntil(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/incidents/1/log_entries", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "GET")
-		w.Write([]byte(`{"log_entries": [{"id": "1","summary":"foo"}]}`))
-	})
-	var listObj = APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	id := "1"
-	var entriesOpts = ListIncidentLogEntriesOptions{
-		APIListObject: listObj,
-		Includes:      []string{},
-		IsOverview:    true,
-		TimeZone:      "UTC",
-		Since:         "2020-03-27T22:40:00-0700",
-		Until:         "2020-03-28T22:50:00-0700",
-	}
-	res, err := client.ListIncidentLogEntries(id, entriesOpts)
-
-	want := &ListIncidentLogEntriesResponse{
-		APIListObject: listObj,
-		LogEntries: []LogEntry{
-			{
-				APIObject: APIObject{
-					ID:      "1",
-					Summary: "foo",
-				},
-			},
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
 func TestIncident_ResponderRequest(t *testing.T) {
 	setup()
 	defer teardown()
diff --git a/ruleset_test.go b/ruleset_test.go
index 90e2e6d..a20be73 100644
--- a/ruleset_test.go
+++ b/ruleset_test.go
@@ -33,7 +33,7 @@ func TestRuleset_List(t *testing.T) {
 }
 
 // Create Ruleset
-func TestUser_Ruleset(t *testing.T) {
+func TestRuleset_Create(t *testing.T) {
 	setup()
 	defer teardown()
 
diff --git a/user_test.go b/user_test.go
index d6795c2..924ef3f 100644
--- a/user_test.go
+++ b/user_test.go
@@ -313,152 +313,3 @@ func TestUser_UpdateContactMethod(t *testing.T) {
 	}
 	testEqual(t, want, res)
 }
-
-// Get user NotificationRule
-func TestUser_GetUserNotificationRule(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/users/1/notification_rules/1", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "GET")
-		w.Write([]byte(`{"notification_rule": {"id": "1", "start_delay_in_minutes": 1, "urgency": "low", "contact_method": {"id": "1"}}}`))
-	})
-
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	ruleID := "1"
-	userID := "1"
-
-	res, err := client.GetUserNotificationRule(userID, ruleID)
-
-	want := &NotificationRule{
-		ID:                  "1",
-		StartDelayInMinutes: uint(1),
-		Urgency:             "low",
-		ContactMethod: ContactMethod{
-			ID: "1",
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
-// Create user NotificationRule
-func TestUser_CreateUserNotificationRule(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/users/1/notification_rules", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "POST")
-		w.Write([]byte(`{"notification_rule": {"id": "1", "start_delay_in_minutes": 1, "urgency": "low", "contact_method": {"id": "1"}}}`))
-	})
-
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	userID := "1"
-	rule := NotificationRule{
-		Type: "email_contact_method",
-	}
-	res, err := client.CreateUserNotificationRule(userID, rule)
-
-	want := &NotificationRule{
-		ID:                  "1",
-		StartDelayInMinutes: uint(1),
-		Urgency:             "low",
-		ContactMethod: ContactMethod{
-			ID: "1",
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
-// List User NotificationRules
-func TestUser_ListUserNotificationRules(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/users/1/notification_rules", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "GET")
-		w.Write([]byte(`{"notification_rules": [{"id": "1", "start_delay_in_minutes": 1, "urgency": "low", "contact_method": {"id": "1"}}]}`))
-	})
-
-	var listObj = APIListObject{Limit: 0, Offset: 0, More: false, Total: 0}
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	ID := "1"
-
-	res, err := client.ListUserNotificationRules(ID)
-
-	want := &ListUserNotificationRulesResponse{
-		APIListObject: listObj,
-		NotificationRules: []NotificationRule{
-			{
-				ID:                  "1",
-				StartDelayInMinutes: uint(1),
-				Urgency:             "low",
-				ContactMethod: ContactMethod{
-					ID: "1",
-				},
-			},
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
-// Update user NotificationRule
-func TestUser_UpdateUserNotificationRule(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/users/1/notification_rules/1", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "PUT")
-		w.Write([]byte(`{"notification_rule": {"id": "1", "start_delay_in_minutes": 1, "urgency": "low", "contact_method": {"id": "1"}}}`))
-	})
-
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	userID := "1"
-	rule := NotificationRule{
-		ID:   "1",
-		Type: "email_contact_method",
-	}
-	res, err := client.UpdateUserNotificationRule(userID, rule)
-
-	want := &NotificationRule{
-		ID:                  "1",
-		StartDelayInMinutes: uint(1),
-		Urgency:             "low",
-		ContactMethod: ContactMethod{
-			ID: "1",
-		},
-	}
-
-	if err != nil {
-		t.Fatal(err)
-	}
-	testEqual(t, want, res)
-}
-
-// Delete user NotificationRule
-func TestUser_DeleteUserNotificationRule(t *testing.T) {
-	setup()
-	defer teardown()
-
-	mux.HandleFunc("/users/1/notification_rules/1", func(w http.ResponseWriter, r *http.Request) {
-		testMethod(t, r, "DELETE")
-	})
-	userID := "1"
-	ruleID := "1"
-
-	var client = &Client{apiEndpoint: server.URL, authToken: "foo", HTTPClient: defaultHTTPClient}
-	if err := client.DeleteUserNotificationRule(userID, ruleID); err != nil {
-		t.Fatal(err)
-	}
-}