1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

Fix objtree acl tests

This commit is contained in:
mcrakhman 2024-11-25 13:21:23 +01:00
parent e95cf6b784
commit 014412646e
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -410,9 +410,9 @@ func TestObjectTree(t *testing.T) {
require.NoError(t, err)
chCount := 0
err = treeCopy.IterateRoot(func(change *Change, decrypted []byte) (any, error) {
chCount++
return nil, nil
}, func(change *Change) bool {
chCount++
return true
})
require.Equal(t, 2, chCount)
@ -421,7 +421,7 @@ func TestObjectTree(t *testing.T) {
t.Run("filter changes when no aclHeadId", func(t *testing.T) {
exec := list.NewAclExecutor("spaceId")
store := newStore(ctx, t)
storeA := newStore(ctx, t)
type cmdErr struct {
cmd string
err error
@ -446,7 +446,8 @@ func TestObjectTree(t *testing.T) {
IsEncrypted: true,
}, aAccount.Acl)
require.NoError(t, err)
aStore, _ := createStorage(ctx, root, store)
aStore, err := createStorage(ctx, root, storeA)
require.NoError(t, err)
aTree, err := BuildKeyFilterableObjectTree(aStore, aAccount.Acl)
require.NoError(t, err)
_, err = aTree.AddContent(ctx, SignableChangeContent{
@ -457,8 +458,8 @@ func TestObjectTree(t *testing.T) {
DataType: mockDataType,
})
require.NoError(t, err)
storeB := copyStore(ctx, t, store.(testStore), "b")
bStore, err := createStorage(ctx, root, storeB)
storeB := copyStore(ctx, t, storeA.(testStore), "b")
bStore, err := newStorage(ctx, root.Id, storeB)
require.NoError(t, err)
// copying old version of storage
prevAclRecs, err := bAccount.Acl.RecordsAfter(ctx, "")