chore(all): remove deprecated io/ioutil import
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -32,11 +31,11 @@ func Test_fetchAPI(t *testing.T) {
|
||||
},
|
||||
"no server": {
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`{}`)),
|
||||
responseBody: io.NopCloser(strings.NewReader(`{}`)),
|
||||
},
|
||||
"success": {
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`{"servers":[
|
||||
responseBody: io.NopCloser(strings.NewReader(`{"servers":[
|
||||
{"country":"Country1","city":"City A","isp":"xyz","is_active":true,"hostnames":{"openvpn":"hosta"}},
|
||||
{"country":"Country2","city":"City B","isp":"abc","is_active":false,"hostnames":{"openvpn":"hostb"}}
|
||||
]}`)),
|
||||
|
||||
@@ -3,7 +3,7 @@ package updater
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -145,7 +145,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
||||
return &http.Response{
|
||||
StatusCode: testCase.responseStatus,
|
||||
Status: http.StatusText(testCase.responseStatus),
|
||||
Body: ioutil.NopCloser(strings.NewReader(testCase.responseBody)),
|
||||
Body: io.NopCloser(strings.NewReader(testCase.responseBody)),
|
||||
}, nil
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package updater
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -41,7 +40,7 @@ func Test_fetchServers(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
responseStatus: http.StatusOK,
|
||||
//nolint:lll
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`
|
||||
responseBody: io.NopCloser(strings.NewReader(`
|
||||
<div>
|
||||
<table id="location-table">
|
||||
<tbody>
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -34,7 +33,7 @@ func Test_addServersFromAPI(t *testing.T) {
|
||||
"existinghost": {Hostname: "existinghost"},
|
||||
},
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`[
|
||||
responseBody: io.NopCloser(strings.NewReader(`[
|
||||
{"connectionName":"host1","region":"region1","country":"country1","location":"location1"},
|
||||
{"connectionName":"host2","region":"region2","country":"country1","location":"location2"}
|
||||
]`)),
|
||||
@@ -111,12 +110,12 @@ func Test_fetchAPI(t *testing.T) {
|
||||
},
|
||||
"no server": {
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`[]`)),
|
||||
responseBody: io.NopCloser(strings.NewReader(`[]`)),
|
||||
data: []serverData{},
|
||||
},
|
||||
"success": {
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`[
|
||||
responseBody: io.NopCloser(strings.NewReader(`[
|
||||
{"connectionName":"host1","region":"region1","country":"country1","location":"location1"},
|
||||
{"connectionName":"host2","region":"region2","country":"country1","location":"location2"}
|
||||
]`)),
|
||||
|
||||
@@ -3,7 +3,6 @@ package updater
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -43,7 +42,7 @@ func Test_fetchServers(t *testing.T) {
|
||||
"success": {
|
||||
ctx: context.Background(),
|
||||
responseStatus: http.StatusOK,
|
||||
responseBody: ioutil.NopCloser(strings.NewReader(`
|
||||
responseBody: io.NopCloser(strings.NewReader(`
|
||||
<div class="blk blk--white locations-list">
|
||||
<div class="blk__i">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user