mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-14 07:19:02 +00:00
Cleanup api responses
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user