major refactoring of the api
This commit is contained in:
1 parent
d4f7dc57fc
commit
f0628e4682
38 files changed
+821
-367
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user