mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 21:05:26 +00:00
27 lines
814 B
Go
27 lines
814 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","authors":["forgedhallpass","ice3man"],"tags":["cve","misc"],"description":"Test description","reference":"reference1","severity":"high"}`
|
||
|
|
assert.Equal(t, expected, string(result))
|
||
|
|
}
|