@@ -18,30 +18,29 @@ func TestZoneCacheVariants(t *testing.T) {
1818 handler := func (w http.ResponseWriter , r * http.Request ) {
1919 assert .Equal (t , http .MethodGet , r .Method , "Expected method 'GET', got %s" , r .Method )
2020 w .Header ().Set ("content-type" , "application/json" )
21- // JSON data from: https://api.cloudflare.com/#zone-cache-settings-get-variants-setting
22- _ , _ = fmt . Fprintf ( w , ` {
23- "success": true,
24- "errors": [],
25- "messages": [],
26- "result": {
27- "id": "variants",
28- "modified_on": "2014-01-01T05:20:00.12345Z",
29- "value": {
30- "avif": [
31- "image/webp",
32- "image/jpeg"
33- ],
34- "bmp": [
35- "image/webp",
36- "image/jpeg"
37- ]
38- }
39- }
40- }` )
21+ fmt . Fprintf ( w , `
22+ {
23+ "success": true,
24+ "errors": [],
25+ "messages": [],
26+ "result": {
27+ "id": "variants",
28+ "modified_on": "2014-01-01T05:20:00.12345Z",
29+ "value": {
30+ "avif": [
31+ "image/webp",
32+ "image/jpeg"
33+ ],
34+ "bmp": [
35+ "image/webp",
36+ "image/jpeg"
37+ ]
38+ }
39+ }
40+ }` )
4141 }
4242
43- testZoneId := "foo"
44- mux .HandleFunc ("/zones/" + testZoneId + "/cache/variants" , handler )
43+ mux .HandleFunc ("/zones/" + testZoneID + "/cache/variants" , handler )
4544
4645 modifiedOn , _ := time .Parse (time .RFC3339 , "2014-01-01T05:20:00.12345Z" )
4746 want := ZoneCacheVariants {
@@ -58,14 +57,14 @@ func TestZoneCacheVariants(t *testing.T) {
5857 },
5958 }
6059
61- actual , err := client .ZoneCacheVariants (context .Background (), testZoneId )
60+ actual , err := client .ZoneCacheVariants (context .Background (), testZoneID )
6261
6362 if assert .NoError (t , err ) {
6463 assert .Equal (t , want , actual )
6564 }
6665}
6766
68- func TestUpdateZoneCacheVariants (t * testing.T ) {
67+ func TestZoneCacheVariantsUpdate (t * testing.T ) {
6968 setup ()
7069 defer teardown ()
7170
@@ -80,30 +79,29 @@ func TestUpdateZoneCacheVariants(t *testing.T) {
8079 }
8180
8281 w .Header ().Set ("content-type" , "application/json" )
83- // JSON data from: https://api.cloudflare.com/#zone-cache-settings-change-variants-setting
84- _ , _ = fmt . Fprintf ( w , ` {
85- "success": true,
86- "errors": [],
87- "messages": [],
88- "result": {
89- "id": "variants",
90- "modified_on": "2014-01-01T05:20:00.12345Z",
91- "value": {
92- "avif": [
93- "image/webp",
94- "image/jpeg"
95- ],
96- "bmp": [
97- "image/webp",
98- "image/jpeg"
99- ]
100- }
101- }
102- }` )
82+ fmt . Fprintf ( w , `
83+ {
84+ "success": true,
85+ "errors": [],
86+ "messages": [],
87+ "result": {
88+ "id": "variants",
89+ "modified_on": "2014-01-01T05:20:00.12345Z",
90+ "value": {
91+ "avif": [
92+ "image/webp",
93+ "image/jpeg"
94+ ],
95+ "bmp": [
96+ "image/webp",
97+ "image/jpeg"
98+ ]
99+ }
100+ }
101+ }` )
103102 }
104103
105- testZoneId := "foo"
106- mux .HandleFunc ("/zones/" + testZoneId + "/cache/variants" , handler )
104+ mux .HandleFunc ("/zones/" + testZoneID + "/cache/variants" , handler )
107105
108106 modifiedOn , _ := time .Parse (time .RFC3339 , "2014-01-01T05:20:00.12345Z" )
109107
@@ -131,14 +129,14 @@ func TestUpdateZoneCacheVariants(t *testing.T) {
131129 "image/jpeg" ,
132130 }}
133131
134- actual , err := client .UpdateZoneCacheVariants (context .Background (), testZoneId , zoneCacheVariants )
132+ actual , err := client .UpdateZoneCacheVariants (context .Background (), testZoneID , zoneCacheVariants )
135133
136134 if assert .NoError (t , err ) {
137135 assert .Equal (t , want , actual )
138136 }
139137}
140138
141- func TestDeleteZoneCacheVariants (t * testing.T ) {
139+ func TestZoneCacheVariantsDelete (t * testing.T ) {
142140 setup ()
143141 defer teardown ()
144142
@@ -149,22 +147,21 @@ func TestDeleteZoneCacheVariants(t *testing.T) {
149147 assert .Equal (t , http .MethodDelete , r .Method , "Expected method 'DELETE', got %s" , r .Method )
150148
151149 w .Header ().Set ("content-type" , "application/json" )
152- // JSON data from: https://api.cloudflare.com/#zone-cache-settings-delete-variants-setting
153- _ , _ = fmt . Fprintf ( w , ` {
154- "success": true,
155- "errors": [],
156- "messages": [],
157- "result": {
158- "id": "variants",
159- "modified_on": "2014-01-01T05:20:00.12345Z"
160- }
161- }` )
150+ fmt . Fprintf ( w , `
151+ {
152+ "success": true,
153+ "errors": [],
154+ "messages": [],
155+ "result": {
156+ "id": "variants",
157+ "modified_on": "2014-01-01T05:20:00.12345Z"
158+ }
159+ }` )
162160 }
163161
164- testZoneId := "foo"
165- mux .HandleFunc ("/zones/" + testZoneId + "/cache/variants" , handler )
162+ mux .HandleFunc ("/zones/" + testZoneID + "/cache/variants" , handler )
166163
167- err := client .DeleteZoneCacheVariants (context .Background (), testZoneId )
164+ err := client .DeleteZoneCacheVariants (context .Background (), testZoneID )
168165
169166 assert .NoError (t , err )
170167 assert .True (t , apiCalled )
0 commit comments