From 67ed44cf20a5935137aee2ae566cd0d5956ac269 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 3 Jun 2020 16:21:57 +0300 Subject: [PATCH] remove models tests --- pkg/models_test.go | 60 ---------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 pkg/models_test.go diff --git a/pkg/models_test.go b/pkg/models_test.go deleted file mode 100644 index b59c992..0000000 --- a/pkg/models_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func Test_zabbixParamOutput(t *testing.T) { - tests := []struct { - name string - input ZabbixAPIParams - want string - }{ - { - name: "Mode extend", - input: ZabbixAPIParams{ - Output: &zabbixParamOutput{ - Mode: "extend", - }, - GroupIDs: []string{"test1", "test2"}, - }, - want: `{ "output": "extend", "groupids": ["test1", "test2"] }`, - }, - { - name: "Fields", - input: ZabbixAPIParams{ - Output: &zabbixParamOutput{ - Fields: []string{"name", "key_", "hostid"}, - }, - GroupIDs: []string{"test1", "test2"}, - }, - want: `{ "output": ["name", "key_", "hostid"], "groupids": ["test1", "test2"] }`, - }, - { - name: "No Output", - input: ZabbixAPIParams{ - GroupIDs: []string{"test1", "test2"}, - }, - want: `{ "groupids": ["test1", "test2"] }`, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - jsonOut, err := json.Marshal(tt.input) - fmt.Printf("Output: %s\n", jsonOut) - assert.NoError(t, err) - if !assert.JSONEq(t, tt.want, string(jsonOut)) { - return - } - - objOut := ZabbixAPIParams{} - err = json.Unmarshal(jsonOut, &objOut) - assert.NoError(t, err) - assert.Equal(t, tt.input, objOut) - }) - } -}