4
4
"bytes"
5
5
"context"
6
6
"encoding/json"
7
- "io/ioutil "
7
+ "io"
8
8
"net/http"
9
9
"testing"
10
10
"time"
@@ -46,7 +46,7 @@ func TestClientListClones(t *testing.T) {
46
46
47
47
return & http.Response {
48
48
StatusCode : 200 ,
49
- Body : ioutil .NopCloser (bytes .NewBuffer (body )),
49
+ Body : io .NopCloser (bytes .NewBuffer (body )),
50
50
Header : make (http.Header ),
51
51
}
52
52
})
@@ -70,7 +70,7 @@ func TestClientListClonesWithFailedRequest(t *testing.T) {
70
70
mockClient := NewTestClient (func (r * http.Request ) * http.Response {
71
71
return & http.Response {
72
72
StatusCode : 200 ,
73
- Body : ioutil .NopCloser (bytes .NewBuffer ([]byte {})),
73
+ Body : io .NopCloser (bytes .NewBuffer ([]byte {})),
74
74
Header : make (http.Header ),
75
75
}
76
76
})
@@ -116,7 +116,7 @@ func TestClientCreateClone(t *testing.T) {
116
116
if r .Method == http .MethodPost {
117
117
assert .Equal (t , r .URL .String (), "https://example.com/clone" )
118
118
119
- requestBody , err := ioutil .ReadAll (r .Body )
119
+ requestBody , err := io .ReadAll (r .Body )
120
120
require .NoError (t , err )
121
121
defer func () { _ = r .Body .Close () }()
122
122
@@ -135,7 +135,7 @@ func TestClientCreateClone(t *testing.T) {
135
135
136
136
return & http.Response {
137
137
StatusCode : 200 ,
138
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
138
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
139
139
Header : make (http.Header ),
140
140
}
141
141
})
@@ -191,7 +191,7 @@ func TestClientCreateCloneAsync(t *testing.T) {
191
191
mockClient := NewTestClient (func (r * http.Request ) * http.Response {
192
192
assert .Equal (t , r .URL .String (), "https://example.com/clone" )
193
193
194
- requestBody , err := ioutil .ReadAll (r .Body )
194
+ requestBody , err := io .ReadAll (r .Body )
195
195
require .NoError (t , err )
196
196
defer func () { _ = r .Body .Close () }()
197
197
@@ -204,7 +204,7 @@ func TestClientCreateCloneAsync(t *testing.T) {
204
204
205
205
return & http.Response {
206
206
StatusCode : 200 ,
207
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
207
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
208
208
Header : make (http.Header ),
209
209
}
210
210
})
@@ -239,7 +239,7 @@ func TestClientCreateCloneWithFailedRequest(t *testing.T) {
239
239
mockClient := NewTestClient (func (req * http.Request ) * http.Response {
240
240
return & http.Response {
241
241
StatusCode : 200 ,
242
- Body : ioutil .NopCloser (bytes .NewBuffer ([]byte {})),
242
+ Body : io .NopCloser (bytes .NewBuffer ([]byte {})),
243
243
Header : make (http.Header ),
244
244
}
245
245
})
@@ -287,7 +287,7 @@ func TestClientGetClone(t *testing.T) {
287
287
288
288
return & http.Response {
289
289
StatusCode : 200 ,
290
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
290
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
291
291
Header : make (http.Header ),
292
292
}
293
293
})
@@ -311,7 +311,7 @@ func TestClientGetCloneWithFailedRequest(t *testing.T) {
311
311
mockClient := NewTestClient (func (req * http.Request ) * http.Response {
312
312
return & http.Response {
313
313
StatusCode : 200 ,
314
- Body : ioutil .NopCloser (bytes .NewBuffer ([]byte {})),
314
+ Body : io .NopCloser (bytes .NewBuffer ([]byte {})),
315
315
Header : make (http.Header ),
316
316
}
317
317
})
@@ -353,7 +353,7 @@ func TestClientUpdateClone(t *testing.T) {
353
353
mockClient := NewTestClient (func (r * http.Request ) * http.Response {
354
354
assert .Equal (t , r .URL .String (), "https://example.com/clone/testCloneID" )
355
355
356
- requestBody , err := ioutil .ReadAll (r .Body )
356
+ requestBody , err := io .ReadAll (r .Body )
357
357
require .NoError (t , err )
358
358
defer func () { _ = r .Body .Close () }()
359
359
@@ -369,7 +369,7 @@ func TestClientUpdateClone(t *testing.T) {
369
369
370
370
return & http.Response {
371
371
StatusCode : 200 ,
372
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
372
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
373
373
Header : make (http.Header ),
374
374
}
375
375
})
@@ -403,7 +403,7 @@ func TestClientUpdateCloneWithFailedRequest(t *testing.T) {
403
403
404
404
return & http.Response {
405
405
StatusCode : 400 ,
406
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
406
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
407
407
Header : make (http.Header ),
408
408
}
409
409
})
@@ -443,7 +443,7 @@ func TestClientDestroyClone(t *testing.T) {
443
443
444
444
return & http.Response {
445
445
StatusCode : statusCode ,
446
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
446
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
447
447
Header : make (http.Header ),
448
448
}
449
449
})
@@ -468,7 +468,7 @@ func TestClientDestroyCloneAsync(t *testing.T) {
468
468
469
469
return & http.Response {
470
470
StatusCode : 200 ,
471
- Body : ioutil .NopCloser (bytes .NewBuffer (nil )),
471
+ Body : io .NopCloser (bytes .NewBuffer (nil )),
472
472
Header : make (http.Header ),
473
473
}
474
474
})
@@ -499,7 +499,7 @@ func TestClientDestroyCloneWithFailedRequest(t *testing.T) {
499
499
500
500
return & http.Response {
501
501
StatusCode : 404 ,
502
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
502
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
503
503
Header : make (http.Header ),
504
504
}
505
505
})
@@ -541,7 +541,7 @@ func TestClientResetClone(t *testing.T) {
541
541
542
542
return & http.Response {
543
543
StatusCode : 200 ,
544
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
544
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
545
545
Header : make (http.Header ),
546
546
}
547
547
})
@@ -566,7 +566,7 @@ func TestClientResetCloneAsync(t *testing.T) {
566
566
567
567
return & http.Response {
568
568
StatusCode : 200 ,
569
- Body : ioutil .NopCloser (bytes .NewBuffer (nil )),
569
+ Body : io .NopCloser (bytes .NewBuffer (nil )),
570
570
Header : make (http.Header ),
571
571
}
572
572
})
@@ -597,7 +597,7 @@ func TestClientResetCloneWithFailedRequest(t *testing.T) {
597
597
598
598
return & http.Response {
599
599
StatusCode : 401 ,
600
- Body : ioutil .NopCloser (bytes .NewBuffer (responseBody )),
600
+ Body : io .NopCloser (bytes .NewBuffer (responseBody )),
601
601
Header : make (http.Header ),
602
602
}
603
603
})
0 commit comments