acl
This commit is contained in:
+12
-8
@@ -16,7 +16,7 @@ func TestListLibraries(t *testing.T) {
|
||||
mustLibrary(t, service, owner, "Photos")
|
||||
mustLibrary(t, service, owner, "Films")
|
||||
|
||||
libraries, err := service.ListLibraries(ctx)
|
||||
libraries, err := service.ListLibraries(ctx, owner.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("ListLibraries : %v", err)
|
||||
}
|
||||
@@ -37,7 +37,7 @@ func TestListChildren(t *testing.T) {
|
||||
mustFolder(t, service, owner, library.ID, "B")
|
||||
a := mustFolder(t, service, owner, library.ID, "A")
|
||||
|
||||
children, err := service.ListChildren(ctx, library.ID)
|
||||
children, err := service.ListChildren(ctx, owner.ID, library.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("ListChildren : %v", err)
|
||||
}
|
||||
@@ -45,11 +45,11 @@ func TestListChildren(t *testing.T) {
|
||||
t.Fatalf("enfants = %+v", children)
|
||||
}
|
||||
|
||||
if _, err := service.Trash(ctx, a.ID, owner.ID); err != nil {
|
||||
if _, err := service.Trash(ctx, owner.ID, a.ID); err != nil {
|
||||
t.Fatalf("Trash : %v", err)
|
||||
}
|
||||
|
||||
children, err = service.ListChildren(ctx, library.ID)
|
||||
children, err = service.ListChildren(ctx, owner.ID, library.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("ListChildren après trash : %v", err)
|
||||
}
|
||||
@@ -64,11 +64,11 @@ func TestGetDeletedDocument(t *testing.T) {
|
||||
owner := mustUser(t, service, "owner")
|
||||
library := mustLibrary(t, service, owner, "Photos")
|
||||
|
||||
if _, err := service.Trash(ctx, library.ID, owner.ID); err != nil {
|
||||
if _, err := service.Trash(ctx, owner.ID, library.ID); err != nil {
|
||||
t.Fatalf("Trash : %v", err)
|
||||
}
|
||||
|
||||
deleted, err := service.Get(ctx, library.ID)
|
||||
deleted, err := service.Get(ctx, owner.ID, library.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("Get : %v", err)
|
||||
}
|
||||
@@ -85,12 +85,14 @@ func TestGetDeletedDocument(t *testing.T) {
|
||||
|
||||
func TestGetMissingDocument(t *testing.T) {
|
||||
service := newTestService(t)
|
||||
ctx := context.Background()
|
||||
owner := mustUser(t, service, "owner")
|
||||
missing, err := ident.NewV7()
|
||||
if err != nil {
|
||||
t.Fatalf("NewV7 : %v", err)
|
||||
}
|
||||
|
||||
_, err = service.Get(context.Background(), missing)
|
||||
_, err = service.Get(ctx, owner.ID, missing)
|
||||
if !errors.Is(err, ErrDocumentNotFound) {
|
||||
t.Fatalf("erreur = %v, attendu ErrDocumentNotFound", err)
|
||||
}
|
||||
@@ -98,12 +100,14 @@ func TestGetMissingDocument(t *testing.T) {
|
||||
|
||||
func TestListChildrenMissingParent(t *testing.T) {
|
||||
service := newTestService(t)
|
||||
ctx := context.Background()
|
||||
owner := mustUser(t, service, "owner")
|
||||
missing, err := ident.NewV7()
|
||||
if err != nil {
|
||||
t.Fatalf("NewV7 : %v", err)
|
||||
}
|
||||
|
||||
_, err = service.ListChildren(context.Background(), missing)
|
||||
_, err = service.ListChildren(ctx, owner.ID, missing)
|
||||
if !errors.Is(err, ErrDocumentNotFound) {
|
||||
t.Fatalf("erreur = %v, attendu ErrDocumentNotFound", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user