From bb46781244fbb70e5471deb55b81ff58384263f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB?= Date: Wed, 8 Apr 2020 14:17:21 +0300 Subject: [PATCH] check correct decoding from json --- v1/client_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/v1/client_test.go b/v1/client_test.go index 4e7436f..d7443eb 100644 --- a/v1/client_test.go +++ b/v1/client_test.go @@ -247,7 +247,21 @@ func TestMgClient_TransportTemplates(t *testing.T) { assert.NoError(t, err, fmt.Sprintf("%d %s", status, err)) t.Logf("Templates found: %#v", len(data)) - t.Logf("%#v", data) + + for _, item := range data { + for _, tpl := range item.Template { + if tpl.Type == TemplateItemTypeText { + assert.Empty(t, tpl.VarType) + } else { + assert.Empty(t, tpl.Text) + assert.NotEmpty(t, tpl.VarType) + + if _, ok := templateVarAssoc[tpl.VarType]; !ok { + t.Errorf("unknown TemplateVar type %s", tpl.VarType) + } + } + } + } } func TestMgClient_ActivateTemplate(t *testing.T) {