H2 owner-pass-with-units-stopped: the pass-back row keeps a placed child, another user's entry and a file with two links

Builds: design 47 H2 H-A-602 (the pass back), AC-H2a, AC-H3
This commit is contained in:
2026-11-25 18:57:09 +01:00
parent 6d866665c2
commit 8e4ede6f96
+10 -4
View File
@@ -42,8 +42,9 @@ func TestADirectoryGivesItsContentsTheNewOwner(t *testing.T) {
want: []string{"data", "data/repo", "link", "token"}},
{name: "an entry with two hard links is left with its owner, and said", from: [2]int{me, myGroup}, linked: true,
want: []string{"data", "data/repo", "kept", "kept/webhook.secret", "link"}},
{name: "given back to the earlier account it keeps the same three: the user, the group only where it was the new one's, the rest left",
from: [2]int{me, myGroup}, back: true, want: []string{"data", "data/repo", "kept", "kept/webhook.secret", "link", "token"}},
{name: "given back to the earlier account it keeps the same three: a placed child, an entry of another user, a file with two links",
from: [2]int{me, myGroup}, back: true, linked: true,
placed: func(root string) []string { return []string{filepath.Join(root, "data")} }, want: []string{"link"}},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
@@ -78,9 +79,14 @@ func TestADirectoryGivesItsContentsTheNewOwner(t *testing.T) {
wantGroup := to[1]
from, target := c.from, to
if c.back {
// What the pass gave is now owned by the new account: every entry reads as to's, and goes back to c.from.
// What the pass gave is now owned by the new account: every entry but kept reads as to's, and goes back to c.from.
from, target, wantGroup = to, c.from, c.from[1]
ownerRead = func(os.FileInfo) (int, int, bool) { return to[0], to[1], true }
ownerRead = func(info os.FileInfo) (int, int, bool) {
if info.Name() == "kept" { // another user's entry, and what lies below it
return to[0] + 1, to[1], true
}
return to[0], to[1], true
}
defer func() { ownerRead = statOwner }()
}
if c.group != 0 {