9 func TestHostMarshal(t *testing.T) {
10 s := `{"attrs":{"address":"192.0.2.1","address6":"2001:db8::","groups":["test"],"check_command":"dummy","display_name":"Example host"}}`
11 want := make(map[string]interface{})
12 if err := json.Unmarshal([]byte(s), &want); err != nil {
16 p, err := json.Marshal(Host{
19 Address6: "2001:db8::",
20 Groups: []string{"test"},
23 CheckCommand: "dummy",
24 DisplayName: "Example host",
29 got := make(map[string]interface{})
30 if err := json.Unmarshal(p, &got); err != nil {
34 if !reflect.DeepEqual(want, got) {
37 t.Log("want", want, "got", got)