Cleanup api responses

This commit is contained in:
simon987
2019-02-16 19:44:03 -05:00
parent 8784b536d3
commit 71e05ecdd6
21 changed files with 809 additions and 888 deletions

View File

@@ -1,28 +1,19 @@
package test
import (
"encoding/json"
"github.com/simon987/task_tracker/api"
"io/ioutil"
"testing"
)
func TestIndex(t *testing.T) {
r := Get("/", nil, nil)
var info InfoAR
UnmarshalResponse(r, &info)
body, _ := ioutil.ReadAll(r.Body)
var info api.Info
err := json.Unmarshal(body, &info)
if err != nil {
t.Error(err.Error())
}
if len(info.Name) <= 0 {
if len(info.Info.Name) <= 0 {
t.Error()
}
if len(info.Version) <= 0 {
if len(info.Info.Version) <= 0 {
t.Error()
}
}