1
0
mirror of synced 2026-10-23 00:48:56 +03:00
Files
step-ca/templates/values_test.go
Mariano Cano c2d9139d18 Add support for ML-DSA keys
This commit adds support for ML-DSA keys and modernizes Go using go fix.
2026-09-03 14:28:33 -07:00

53 lines
1.3 KiB
Go

package templates
import (
"reflect"
"testing"
)
func TestDefaultTemplates(t *testing.T) {
sshTemplates := DefaultSSHTemplates
sshTemplatesData := DefaultSSHTemplateData
t.Cleanup(func() {
DefaultSSHTemplates = sshTemplates
DefaultSSHTemplateData = sshTemplatesData
})
DefaultSSHTemplates = SSHTemplates{
User: []Template{
{Name: "foo.tpl", Type: Snippet, TemplatePath: "templates/ssh/foo.tpl", Path: "/tmp/foo", Comment: "#"},
},
Host: []Template{
{Name: "bar.tpl", Type: Snippet, TemplatePath: "templates/ssh/bar.tpl", Path: "/tmp/bar", Comment: "#"},
},
}
DefaultSSHTemplateData = map[string]string{
"foo.tpl": "foo",
"bar.tpl": "bar",
}
tests := []struct {
name string
want *Templates
}{
{"ok", &Templates{
SSH: &SSHTemplates{
User: []Template{
{Name: "foo.tpl", Type: Snippet, Content: []byte("foo"), Path: "/tmp/foo", Comment: "#"},
},
Host: []Template{
{Name: "bar.tpl", Type: Snippet, Content: []byte("bar"), Path: "/tmp/bar", Comment: "#"},
},
},
Data: map[string]any{},
}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := DefaultTemplates(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("DefaultTemplates() = %v, want %v", got, tt.want)
}
})
}
}