1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Test group file permissions.

This commit is contained in:
Juliusz Chroboczek 2024-04-14 00:26:03 +02:00
parent a3f894a31e
commit 3ee5290b71

View file

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"os" "os"
"path/filepath"
"reflect" "reflect"
"testing" "testing"
) )
@ -204,6 +205,14 @@ func TestWritableGroups(t *testing.T) {
t.Errorf("GetDescription: got %v", err) t.Errorf("GetDescription: got %v", err)
} }
fi, err := os.Stat(filepath.Join(Directory, "test.json"))
if err != nil {
t.Errorf("Stat: %v", err)
}
if mode := fi.Mode(); mode != 0o600 {
t.Errorf("Mode is 0o%03o (expected 0o600)\n", mode)
}
desc, token, err := GetSanitisedDescription("test") desc, token, err := GetSanitisedDescription("test")
if err != nil || token == "" { if err != nil || token == "" {
t.Errorf("GetSanitisedDescription: got %v", err) t.Errorf("GetSanitisedDescription: got %v", err)