mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 17:56:56 +00:00
27 lines
813 B
Go
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))
|
|
}
|