forked from security/hakurei
None of these are valid with their zero value, and the implementations assume they are created by the builder methods. They are by all means an implementation detail and exporting them makes no sense. Signed-off-by: Ophestra <cat@gensokyo.uk>
35 lines
737 B
Go
35 lines
737 B
Go
package system
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestChangeHosts(t *testing.T) {
|
|
testCases := []string{"chronos", "keyring", "cat", "kbd", "yonah"}
|
|
for _, tc := range testCases {
|
|
t.Run("append ChangeHosts operation for "+tc, func(t *testing.T) {
|
|
sys := New(t.Context(), 150)
|
|
sys.ChangeHosts(tc)
|
|
(&tcOp{EX11, tc}).test(t, sys.ops, []Op{
|
|
xhostOp(tc),
|
|
}, "ChangeHosts")
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestXHost_String(t *testing.T) {
|
|
testCases := []struct {
|
|
username string
|
|
want string
|
|
}{
|
|
{"chronos", "SI:localuser:chronos"},
|
|
}
|
|
for _, tc := range testCases {
|
|
t.Run(tc.want, func(t *testing.T) {
|
|
if got := xhostOp(tc.username).String(); got != tc.want {
|
|
t.Errorf("String() = %v, want %v", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|