major refactoring of the api

This commit is contained in:
didier amyot committed 2015-03-28 20:53:28 -07:00
1 parent d4f7dc57fc
commit f0628e4682
38 files changed
+821 -367

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package serverstat
import (
"encoding/json"
"reflect"
"testing"
)
import "github.com/didiercrunch/doormanserver/shared"
func deserializeServerStats(data []byte) *ServerStat {
ret := new(ServerStat)
if err := json.Unmarshal(data, ret); err != nil {
panic("cannot deserialize data")
}
return ret
}
func ServerStatsEqual(a, b *ServerStat) bool {
return reflect.DeepEqual(a, b)
}
func TestGetTrivial(t *testing.T) {
p := new(shared.Params)
expected := &ServerStat{Go: GO_VERSION}
if s := Get(p); !ServerStatsEqual(s, expected) {
t.Error(s)
}
}