nuclei/v2/pkg/model/model_test.go
forgedhallpass 456544d5be RES-84 # Improve Nuclei CLI interface
* Fixed Template Author mapping
2021-08-17 14:05:52 +03:00

27 lines
813 B
Go

package model
import (
"encoding/json"
"testing"
"github.com/projectdiscovery/nuclei/v2/internal/severity"
"github.com/stretchr/testify/assert"
)
func TestInfoJsonMarshal(t *testing.T) {
info := Info{
Name: "Test Template Name",
Authors: StringSlice{[]string{"forgedhallpass", "ice3man"}},
Description: "Test description",
SeverityHolder: severity.SeverityHolder{Severity: severity.High},
Tags: StringSlice{[]string{"cve", "misc"}},
Reference: StringSlice{"reference1"},
}
result, err := json.Marshal(&info)
assert.Nil(t, err)
expected := `{"name":"Test Template Name","author":["forgedhallpass","ice3man"],"tags":["cve","misc"],"description":"Test description","reference":"reference1","severity":"high"}`
assert.Equal(t, expected, string(result))
}