Repository: cloudflare/cloudflare-go
Pull request #1074 (2022-08-30 23:38:54)

access_service_tokens: add method for refreshing tokens instead of replacing
Allows bumping a service token instead of fully replacing and needing to update everywhere.


Patch:
diff --git a/.changelog/1067.txt b/.changelog/1067.txt
deleted file mode 100644
index a560e4ad6..000000000
--- a/.changelog/1067.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:dependency
-deps: bumps goreleaser/goreleaser-action from 3.0.0 to 3.1.0
-```
diff --git a/.changelog/1068.txt b/.changelog/1068.txt
deleted file mode 100644
index fa7259c79..000000000
--- a/.changelog/1068.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:enhancement
-api: addded context and headers to Raw method
-```
diff --git a/.changelog/1070.txt b/.changelog/1070.txt
deleted file mode 100644
index d3586c87e..000000000
--- a/.changelog/1070.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:bug
-email_routing_rules: Fix response for email routing catch all rule.
-```
\ No newline at end of file
diff --git a/.changelog/1071.txt b/.changelog/1071.txt
deleted file mode 100644
index 124a8d794..000000000
--- a/.changelog/1071.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:enhancement
-url_normalization_settings: Add APIs to get and update URL normalization settings
-```
\ No newline at end of file
diff --git a/.changelog/1073.txt b/.changelog/1073.txt
deleted file mode 100644
index 54216744a..000000000
--- a/.changelog/1073.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-```release-note:enhancement
-teams_account: add support for `os_distro_name` and `os_distro_revision`
-```
diff --git a/.changelog/1074.txt b/.changelog/1074.txt
new file mode 100644
index 000000000..1ecbf3228
--- /dev/null
+++ b/.changelog/1074.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+access_service_token: add support for refreshing an existing token in place
+```
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 33f24363b..cb50cdaf4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -17,7 +17,7 @@ jobs:
         with:
           go-version: ^1.17
       - name: Run GoReleaser
-        uses: goreleaser/goreleaser-action@v3.1.0
+        uses: goreleaser/goreleaser-action@v3.0.0
         with:
           version: latest
           args: release --rm-dist
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83a1f6aa9..0da1f3358 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,25 +2,17 @@
 
 ENHANCEMENTS:
 
-* api: addded context and headers to Raw method ([#1068](https://github.com/cloudflare/cloudflare-go/issues/1068))
 * api_shield: add GET/PUT for API Shield Configuration ([#1059](https://github.com/cloudflare/cloudflare-go/issues/1059))
 * pages_project: Add `kv_namespaces`, `durable_object_namespaces`, `r2_buckets`, and `d1_databases` bindings to deployment config ([#1065](https://github.com/cloudflare/cloudflare-go/issues/1065))
 * pages_project: Add `preview_deployment_setting`, `preview_branch_includes`, and `preview_branch_excludes` to source config ([#1065](https://github.com/cloudflare/cloudflare-go/issues/1065))
 * pages_project: Add `production_branch` field ([#1065](https://github.com/cloudflare/cloudflare-go/issues/1065))
-* teams_account: add support for `os_distro_name` and `os_distro_revision` ([#1073](https://github.com/cloudflare/cloudflare-go/issues/1073))
-* url_normalization_settings: Add APIs to get and update URL normalization settings ([#1071](https://github.com/cloudflare/cloudflare-go/issues/1071))
 * workers: Support for multipart encoding for DownloadWorker on a module-format Worker script ([#1040](https://github.com/cloudflare/cloudflare-go/issues/1040))
 
 BUG FIXES:
 
-* email_routing_rules: Fix response for email routing catch all rule. ([#1070](https://github.com/cloudflare/cloudflare-go/issues/1070))
 * email_routing_settings: change enable endpoint from `enabled` to `enable` ([#1060](https://github.com/cloudflare/cloudflare-go/issues/1060))
 * stream: Update pctComplete to string from int ([#1066](https://github.com/cloudflare/cloudflare-go/issues/1066))
 
-DEPENDENCIES:
-
-* deps: bumps goreleaser/goreleaser-action from 3.0.0 to 3.1.0 ([#1067](https://github.com/cloudflare/cloudflare-go/issues/1067))
-
 ## 0.48.0 (August 22nd, 2022)
 
 ENHANCEMENTS:
diff --git a/access_service_tokens.go b/access_service_tokens.go
index fec466cb9..da3debf22 100644
--- a/access_service_tokens.go
+++ b/access_service_tokens.go
@@ -30,6 +30,17 @@ type AccessServiceTokenUpdateResponse struct {
 	ClientID  string     `json:"client_id"`
 }
 
+// AccessServiceTokenRefreshResponse represents the response from the API
+// when an existing service token is refreshed to last longer.
+type AccessServiceTokenRefreshResponse struct {
+	CreatedAt *time.Time `json:"created_at"`
+	UpdatedAt *time.Time `json:"updated_at"`
+	ExpiresAt *time.Time `json:"expires_at"`
+	ID        string     `json:"id"`
+	Name      string     `json:"name"`
+	ClientID  string     `json:"client_id"`
+}
+
 // AccessServiceTokenCreateResponse is the same API response as the Update
 // operation with the exception that the `ClientSecret` is present in a
 // Create operation.
@@ -78,6 +89,15 @@ type AccessServiceTokensUpdateDetailResponse struct {
 	Result   AccessServiceTokenUpdateResponse `json:"result"`
 }
 
+// AccessServiceTokensRefreshDetailResponse is the API response, containing a
+// single Access Service Token.
+type AccessServiceTokensRefreshDetailResponse struct {
+	Success  bool                              `json:"success"`
+	Errors   []string                          `json:"errors"`
+	Messages []string                          `json:"messages"`
+	Result   AccessServiceTokenRefreshResponse `json:"result"`
+}
+
 // AccessServiceTokens returns all Access Service Tokens for an account.
 //
 // API reference: https://api.cloudflare.com/#access-service-tokens-list-access-service-tokens
@@ -213,3 +233,24 @@ func (api *API) deleteAccessServiceToken(ctx context.Context, id, uuid string, r
 
 	return accessServiceTokenUpdate.Result, nil
 }
+
+// RefreshAccessServiceToken updates the expiry of an Access Service Token
+// in place.
+//
+// API reference: https://api.cloudflare.com/#access-service-tokens-refresh-a-service-token
+func (api *API) RefreshAccessServiceToken(ctx context.Context, rc *ResourceContainer, id string) (AccessServiceTokenRefreshResponse, error) {
+	uri := fmt.Sprintf("/%s/%s/access/service_tokens/%s/refresh", rc.Level, rc.Identifier, id)
+
+	res, err := api.makeRequestContext(ctx, http.MethodPost, uri, nil)
+	if err != nil {
+		return AccessServiceTokenRefreshResponse{}, err
+	}
+
+	var accessServiceTokenRefresh AccessServiceTokensRefreshDetailResponse
+	err = json.Unmarshal(res, &accessServiceTokenRefresh)
+	if err != nil {
+		return AccessServiceTokenRefreshResponse{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
+	}
+
+	return accessServiceTokenRefresh.Result, nil
+}
diff --git a/cloudflare.go b/cloudflare.go
index b41550e12..c14990dcc 100644
--- a/cloudflare.go
+++ b/cloudflare.go
@@ -473,8 +473,8 @@ type RawResponse struct {
 
 // Raw makes a HTTP request with user provided params and returns the
 // result as untouched JSON.
-func (api *API) Raw(ctx context.Context, method, endpoint string, data interface{}, headers http.Header) (json.RawMessage, error) {
-	res, err := api.makeRequestContextWithHeaders(ctx, method, endpoint, data, headers)
+func (api *API) Raw(method, endpoint string, data interface{}) (json.RawMessage, error) {
+	res, err := api.makeRequest(method, endpoint, data)
 	if err != nil {
 		return nil, err
 	}
diff --git a/email_routing_rules.go b/email_routing_rules.go
index 22101b624..aa3a694d1 100644
--- a/email_routing_rules.go
+++ b/email_routing_rules.go
@@ -76,11 +76,6 @@ type EmailRoutingCatchAllRule struct {
 	Actions  []EmailRoutingRuleAction  `json:"actions,omitempty"`
 }
 
-type EmailRoutingCatchAllRuleResponse struct {
-	Result EmailRoutingCatchAllRule `json:"result"`
-	Response
-}
-
 // ListEmailRoutingRules Lists existing routing rules.
 //
 // API reference: https://api.cloudflare.com/#email-routing-routing-rules-list-routing-rules
@@ -232,19 +227,21 @@ func (api *API) GetEmailRoutingCatchAllRule(ctx context.Context, rc *ResourceCon
 	if rc.Identifier == "" {
 		return EmailRoutingCatchAllRule{}, ErrMissingZoneID
 	}
+
 	uri := fmt.Sprintf("/zones/%s/email/routing/rules/catch_all", rc.Identifier)
+
 	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
 	if err != nil {
 		return EmailRoutingCatchAllRule{}, err
 	}
 
-	var r EmailRoutingCatchAllRuleResponse
+	var r EmailRoutingCatchAllRule
 	err = json.Unmarshal(res, &r)
 	if err != nil {
 		return EmailRoutingCatchAllRule{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
 	}
 
-	return r.Result, nil
+	return r, nil
 }
 
 // UpdateEmailRoutingCatchAllRule Enable or disable catch-all routing rule, or change action to forward to specific destination address.
@@ -262,11 +259,11 @@ func (api *API) UpdateEmailRoutingCatchAllRule(ctx context.Context, rc *Resource
 		return EmailRoutingCatchAllRule{}, err
 	}
 
-	var r EmailRoutingCatchAllRuleResponse
+	var r EmailRoutingCatchAllRule
 	err = json.Unmarshal(res, &r)
 	if err != nil {
 		return EmailRoutingCatchAllRule{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
 	}
 
-	return r.Result, nil
+	return r, nil
 }
diff --git a/teams_devices.go b/teams_devices.go
index 8836cbe51..2e20e824f 100644
--- a/teams_devices.go
+++ b/teams_devices.go
@@ -18,25 +18,23 @@ type TeamsDeviceDetail struct {
 }
 
 type TeamsDeviceListItem struct {
-	User             UserItem `json:"user,omitempty"`
-	ID               string   `json:"id,omitempty"`
-	Key              string   `json:"key,omitempty"`
-	DeviceType       string   `json:"device_type,omitempty"`
-	Name             string   `json:"name,omitempty"`
-	Model            string   `json:"model,omitempty"`
-	Manufacturer     string   `json:"manufacturer,omitempty"`
-	Deleted          bool     `json:"deleted,omitempty"`
-	Version          string   `json:"version,omitempty"`
-	SerialNumber     string   `json:"serial_number,omitempty"`
-	OSVersion        string   `json:"os_version,omitempty"`
-	OSDistroName     string   `json:"os_distro_name,omitempty"`
-	OsDistroRevision string   `json:"os_distro_revision,omitempty"`
-	MacAddress       string   `json:"mac_address,omitempty"`
-	IP               string   `json:"ip,omitempty"`
-	Created          string   `json:"created,omitempty"`
-	Updated          string   `json:"updated,omitempty"`
-	LastSeen         string   `json:"last_seen,omitempty"`
-	RevokedAt        string   `json:"revoked_at,omitempty"`
+	User         UserItem `json:"user,omitempty"`
+	ID           string   `json:"id,omitempty"`
+	Key          string   `json:"key,omitempty"`
+	DeviceType   string   `json:"device_type,omitempty"`
+	Name         string   `json:"name,omitempty"`
+	Model        string   `json:"model,omitempty"`
+	Manufacturer string   `json:"manufacturer,omitempty"`
+	Deleted      bool     `json:"deleted,omitempty"`
+	Version      string   `json:"version,omitempty"`
+	SerialNumber string   `json:"serial_number,omitempty"`
+	OSVersion    string   `json:"os_version,omitempty"`
+	MacAddress   string   `json:"mac_address,omitempty"`
+	IP           string   `json:"ip,omitempty"`
+	Created      string   `json:"created,omitempty"`
+	Updated      string   `json:"updated,omitempty"`
+	LastSeen     string   `json:"last_seen,omitempty"`
+	RevokedAt    string   `json:"revoked_at,omitempty"`
 }
 
 type UserItem struct {
diff --git a/url_normalization_settings.go b/url_normalization_settings.go
deleted file mode 100644
index c0247ceb9..000000000
--- a/url_normalization_settings.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package cloudflare
-
-import (
-	"context"
-	"encoding/json"
-	"fmt"
-	"net/http"
-)
-
-type URLNormalizationSettings struct {
-	Type  string `json:"type"`
-	Scope string `json:"scope"`
-}
-
-type URLNormalizationSettingsResponse struct {
-	Result URLNormalizationSettings `json:"result"`
-	Response
-}
-
-type URLNormalizationSettingsUpdateParams struct {
-	Type  string `json:"type"`
-	Scope string `json:"scope"`
-}
-
-// URLNormalizationSettings API reference: https://api.cloudflare.com/#url-normalization-get-url-normalization-settings
-func (api *API) URLNormalizationSettings(ctx context.Context, rc *ResourceContainer) (URLNormalizationSettings, error) {
-	uri := fmt.Sprintf("/zones/%s/url_normalization", rc.Identifier)
-
-	res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)
-	if err != nil {
-		return URLNormalizationSettings{}, err
-	}
-
-	var urlNormalizationSettingsResponse URLNormalizationSettingsResponse
-	err = json.Unmarshal(res, &urlNormalizationSettingsResponse)
-	if err != nil {
-		return URLNormalizationSettings{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return urlNormalizationSettingsResponse.Result, nil
-}
-
-// UpdateURLNormalizationSettings https://api.cloudflare.com/#url-normalization-update-url-normalization-settings
-func (api *API) UpdateURLNormalizationSettings(ctx context.Context, rc *ResourceContainer, params URLNormalizationSettingsUpdateParams) (URLNormalizationSettings, error) {
-	uri := fmt.Sprintf("/zones/%s/url_normalization", rc.Identifier)
-
-	res, err := api.makeRequestContext(ctx, http.MethodPut, uri, params)
-	if err != nil {
-		return URLNormalizationSettings{}, err
-	}
-
-	var urlNormalizationSettingsResponse URLNormalizationSettingsResponse
-	err = json.Unmarshal(res, &urlNormalizationSettingsResponse)
-	if err != nil {
-		return URLNormalizationSettings{}, fmt.Errorf("%s: %w", errUnmarshalError, err)
-	}
-
-	return urlNormalizationSettingsResponse.Result, nil
-}


Test patch:
diff --git a/access_service_tokens_test.go b/access_service_tokens_test.go
index fd6df1c2b..391a88b92 100644
--- a/access_service_tokens_test.go
+++ b/access_service_tokens_test.go
@@ -167,6 +167,47 @@ func TestUpdateAccessServiceToken(t *testing.T) {
 	}
 }
 
+func TestRefreshAccessServiceToken(t *testing.T) {
+	setup()
+	defer teardown()
+
+	handler := func(w http.ResponseWriter, r *http.Request) {
+		assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
+		w.Header().Set("content-type", "application/json")
+		fmt.Fprintf(w, `{
+			"success": true,
+			"errors": [],
+			"messages": [],
+			"result": {
+				"created_at": "2014-01-01T05:20:00.12345Z",
+				"updated_at": "2014-01-01T05:20:00.12345Z",
+				"expires_at": "2015-01-01T05:20:00.12345Z",
+				"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+				"name": "CI/CD token",
+				"client_id": "88bf3b6d86161464f6509f7219099e57.access.example.com"
+			}
+		}
+		`)
+	}
+
+	expected := AccessServiceTokenRefreshResponse{
+		CreatedAt: &createdAt,
+		UpdatedAt: &updatedAt,
+		ExpiresAt: &expiresAt,
+		ID:        "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
+		Name:      "CI/CD token",
+		ClientID:  "88bf3b6d86161464f6509f7219099e57.access.example.com",
+	}
+
+	mux.HandleFunc("/accounts/"+testAccountID+"/access/service_tokens/f174e90a-fafe-4643-bbbc-4a0ed4fc8415/refresh", handler)
+
+	actual, err := client.RefreshAccessServiceToken(context.Background(), AccountIdentifier(testAccountID), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415")
+
+	if assert.NoError(t, err) {
+		assert.Equal(t, expected, actual)
+	}
+}
+
 func TestDeleteAccessServiceToken(t *testing.T) {
 	setup()
 	defer teardown()
diff --git a/email_routing_rules_test.go b/email_routing_rules_test.go
index 5a3cdb4d7..502f88ef2 100644
--- a/email_routing_rules_test.go
+++ b/email_routing_rules_test.go
@@ -280,28 +280,22 @@ func TestEmailRouting_GetAllRule(t *testing.T) {
 		assert.Equal(t, http.MethodGet, r.Method, "Expected method 'PUT', got %s", r.Method)
 		w.Header().Set("content-type", "application/json")
 		fmt.Fprint(w, `{
-  "result": {
-    "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
-    "name": "Send to user@example.net rule.",
-    "matchers": [
-      {
-        "type": "all"
-      }
-    ],
-    "actions": [
-      {
-        "type": "forward",
-        "value": [
-          "destinationaddress@example.net"
-        ]
-      }
-    ],
-    "enabled": true,
-    "priority": 2147483647
-  },
-  "success": true,
-  "errors": [],
-  "messages": []
+  "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
+  "name": "Rule send to user@example.net",
+  "enabled": true,
+  "matchers": [
+    {
+      "type": "all"
+    }
+  ],
+  "actions": [
+    {
+      "type": "forward",
+      "value": [
+        "destinationaddress@example.net"
+      ]
+    }
+  ]
 }`)
 	})
 
@@ -312,7 +306,7 @@ func TestEmailRouting_GetAllRule(t *testing.T) {
 
 	want := EmailRoutingCatchAllRule{
 		Tag:     "a7e6fb77503c41d8a7f3113c6918f10c",
-		Name:    "Send to user@example.net rule.",
+		Name:    "Rule send to user@example.net",
 		Enabled: BoolPtr(true),
 		Matchers: []EmailRoutingRuleMatcher{
 			{
@@ -341,28 +335,22 @@ func TestEmailRouting_UpdateAllRule(t *testing.T) {
 		assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
 		w.Header().Set("content-type", "application/json")
 		fmt.Fprint(w, `{
-  "result": {
-    "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
-    "name": "Send to user@example.net rule.",
-    "matchers": [
-      {
-        "type": "all"
-      }
-    ],
-    "actions": [
-      {
-        "type": "forward",
-        "value": [
-          "destinationaddress@example.net"
-        ]
-      }
-    ],
-    "enabled": true,
-    "priority": 2147483647
-  },
-  "success": true,
-  "errors": [],
-  "messages": []
+  "tag": "a7e6fb77503c41d8a7f3113c6918f10c",
+  "name": "Rule send to user@example.net",
+  "enabled": true,
+  "matchers": [
+    {
+      "type": "all"
+    }
+  ],
+  "actions": [
+    {
+      "type": "forward",
+      "value": [
+        "destinationaddress@example.net"
+      ]
+    }
+  ]
 }`)
 	})
 
@@ -373,7 +361,7 @@ func TestEmailRouting_UpdateAllRule(t *testing.T) {
 
 	want := EmailRoutingCatchAllRule{
 		Tag:     "a7e6fb77503c41d8a7f3113c6918f10c",
-		Name:    "Send to user@example.net rule.",
+		Name:    "Rule send to user@example.net",
 		Enabled: BoolPtr(true),
 		Matchers: []EmailRoutingRuleMatcher{
 			{
diff --git a/teams_devices_test.go b/teams_devices_test.go
index b639c164c..566a72a55 100644
--- a/teams_devices_test.go
+++ b/teams_devices_test.go
@@ -39,8 +39,6 @@ func TestTeamsDevicesList(t *testing.T) {
               "version": "1.0.0",
               "serial_number": "EXAMPLEHMD6R",
               "os_version": "10.0.0",
-              "os_distro_name": "ubuntu",
-              "os_distro_revision": "1.0.0",
               "mac_address": "00-00-5E-00-53-00",
               "ip": "192.0.2.1",
               "created": "2017-06-14T00:00:00Z",
@@ -60,23 +58,21 @@ func TestTeamsDevicesList(t *testing.T) {
 			Name:  "John Appleseed",
 			Email: "user@example.com",
 		},
-		Key:              "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
-		DeviceType:       "windows",
-		Name:             "My mobile device",
-		Model:            "MyPhone(pro-X)",
-		Manufacturer:     "My phone corp",
-		Deleted:          true,
-		Version:          "1.0.0",
-		SerialNumber:     "EXAMPLEHMD6R",
-		OSVersion:        "10.0.0",
-		OSDistroName:     "ubuntu",
-		OsDistroRevision: "1.0.0",
-		MacAddress:       "00-00-5E-00-53-00",
-		IP:               "192.0.2.1",
-		Created:          "2017-06-14T00:00:00Z",
-		Updated:          "2017-06-14T00:00:00Z",
-		LastSeen:         "2017-06-14T00:00:00Z",
-		RevokedAt:        "2017-06-14T00:00:00Z",
+		Key:          "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
+		DeviceType:   "windows",
+		Name:         "My mobile device",
+		Model:        "MyPhone(pro-X)",
+		Manufacturer: "My phone corp",
+		Deleted:      true,
+		Version:      "1.0.0",
+		SerialNumber: "EXAMPLEHMD6R",
+		OSVersion:    "10.0.0",
+		MacAddress:   "00-00-5E-00-53-00",
+		IP:           "192.0.2.1",
+		Created:      "2017-06-14T00:00:00Z",
+		Updated:      "2017-06-14T00:00:00Z",
+		LastSeen:     "2017-06-14T00:00:00Z",
+		RevokedAt:    "2017-06-14T00:00:00Z",
 	}}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/devices", handler)
diff --git a/url_normalization_settings_test.go b/url_normalization_settings_test.go
deleted file mode 100644
index 0ad7f67a4..000000000
--- a/url_normalization_settings_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package cloudflare
-
-import (
-	"context"
-	"fmt"
-	"io/ioutil"
-	"net/http"
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-)
-
-func TestURLNormalizationSettings(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method)
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprintf(w, `{
-			"result": {
-				"type": "cloudflare",
-				"scope": "incoming"
-			},
-			"success": true,
-			"errors": [],
-			"messages": []
-		}`)
-	}
-
-	mux.HandleFunc("/zones/"+testZoneID+"/url_normalization", handler)
-
-	want := URLNormalizationSettings{
-		Type:  "cloudflare",
-		Scope: "incoming",
-	}
-
-	got, err := client.URLNormalizationSettings(context.Background(), ZoneIdentifier(testZoneID))
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}
-
-func TestUpdateURLNormalizationSettings(t *testing.T) {
-	setup()
-	defer teardown()
-
-	handler := func(w http.ResponseWriter, r *http.Request) {
-		assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
-		body, err := ioutil.ReadAll(r.Body)
-		if err != nil {
-			panic(err)
-		}
-		defer r.Body.Close()
-
-		assert.Equal(t, `{"type":"cloudflare","scope":"incoming"}`, string(body))
-
-		w.Header().Set("content-type", "application/json")
-		fmt.Fprintf(w, `{
-			"result": {
-				"type": "cloudflare",
-				"scope": "incoming"
-			},
-			"success": true,
-			"errors": [],
-			"messages": []
-		}`)
-	}
-
-	mux.HandleFunc("/zones/"+testZoneID+"/url_normalization", handler)
-
-	params := URLNormalizationSettingsUpdateParams{
-		Type:  "cloudflare",
-		Scope: "incoming",
-	}
-
-	want := URLNormalizationSettings{
-		Type:  "cloudflare",
-		Scope: "incoming",
-	}
-
-	got, err := client.UpdateURLNormalizationSettings(context.Background(), ZoneIdentifier(testZoneID), params)
-	if assert.NoError(t, err) {
-		assert.Equal(t, want, got)
-	}
-}