diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-15 06:41:00 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-15 06:41:00 +0800 |
commit | 266d21209478bdb8c89e1ffb95d7f0de34635968 (patch) | |
tree | ab5075cda6492eee554ad234e4c36734767d2534 /tests/helper/http.go | |
parent | 3d177be73e127b08a52988fde308eed29eac4699 (diff) | |
download | go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.gz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.bz2 go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.lz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.xz go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.tar.zst go-tangerine-266d21209478bdb8c89e1ffb95d7f0de34635968.zip |
Working on test suite
Diffstat (limited to 'tests/helper/http.go')
-rw-r--r-- | tests/helper/http.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/helper/http.go b/tests/helper/http.go new file mode 100644 index 000000000..b379695d0 --- /dev/null +++ b/tests/helper/http.go @@ -0,0 +1,24 @@ +package helper + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func CreateTests(uri string, value interface{}) error { + resp, err := http.Get(uri) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + data, err := ioutil.ReadAll(resp.Body) + + err = json.Unmarshal(data, &value) + if err != nil { + return err + } + + return nil +} |