mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
358 B
25 lines
358 B
package helper
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func CreateTests(t *testing.T, uri string, value interface{}) {
|
|
resp, err := http.Get(uri)
|
|
if err != nil {
|
|
t.Error(err)
|
|
|
|
return
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
data, err := ioutil.ReadAll(resp.Body)
|
|
|
|
err = json.Unmarshal(data, &value)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|