aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helper/http.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-15 06:41:00 +0800
committerobscuren <geffobscura@gmail.com>2014-10-15 06:41:00 +0800
commit266d21209478bdb8c89e1ffb95d7f0de34635968 (patch)
treeab5075cda6492eee554ad234e4c36734767d2534 /tests/helper/http.go
parent3d177be73e127b08a52988fde308eed29eac4699 (diff)
downloadgo-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.go24
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
+}