aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system/xhost_test.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-17 20:28:55 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-17 20:28:55 +0900
commit679e719f9e4d9230482491bf253a0d538f030f08 (patch)
tree4b26de24ea9384dbd5cbf569c924efd2bfdc134c /internal/system/xhost_test.go
parent064db9f02088448b42758dc089787ca7d05b1510 (diff)
system: tests for all Op implementations except DBus
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system/xhost_test.go')
-rw-r--r--internal/system/xhost_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/system/xhost_test.go b/internal/system/xhost_test.go
new file mode 100644
index 00000000..4b364432
--- /dev/null
+++ b/internal/system/xhost_test.go
@@ -0,0 +1,34 @@
+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(150)
+ sys.ChangeHosts(tc)
+ (&tcOp{EX11, tc}).test(t, sys.ops, []Op{
+ XHost(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 := XHost(tc.username).String(); got != tc.want {
+ t.Errorf("String() = %v, want %v", got, tc.want)
+ }
+ })
+ }
+}