mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
e423e17807
- Report NixOS greeter state from `var/lib/dms-greeter` - Allows `dms greeter status` use - Prevent imperative greeter changes on module-managed NixOS systems - Preserve immutable-distro sync policy - Closes #2728
25 lines
756 B
Go
25 lines
756 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestDefaultImmutablePolicyAllowsSyncButBlocksEnable(t *testing.T) {
|
|
var policyFile cliPolicyFile
|
|
if err := json.Unmarshal(defaultCLIPolicyJSON, &policyFile); err != nil {
|
|
t.Fatalf("failed to parse embedded CLI policy: %v", err)
|
|
}
|
|
if policyFile.BlockedCommands == nil {
|
|
t.Fatal("embedded CLI policy has no blocked_commands")
|
|
}
|
|
|
|
blocked := normalizeBlockedCommands(*policyFile.BlockedCommands)
|
|
if !commandBlockedByPolicy("greeter enable", blocked) {
|
|
t.Fatal("expected greeter enable to remain blocked on immutable/image-based systems")
|
|
}
|
|
if commandBlockedByPolicy("greeter sync", blocked) {
|
|
t.Fatal("expected greeter sync to remain available on immutable/image-based systems")
|
|
}
|
|
}
|