From ccebacfc22774002305e217dd32d520433378da6 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Wed, 4 Dec 2024 09:22:08 +0400 Subject: [PATCH] layer: Fix tests Closes #1037. Signed-off-by: Evgenii Baidakov --- api/layer/neofs_mock.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/api/layer/neofs_mock.go b/api/layer/neofs_mock.go index fe51d465..dd2f369e 100644 --- a/api/layer/neofs_mock.go +++ b/api/layer/neofs_mock.go @@ -454,3 +454,30 @@ func getOwner(ctx context.Context) user.ID { return user.ID{} } + +// SearchObjects searches objects with corresponding filters. +func (t *TestNeoFS) SearchObjects(_ context.Context, prm PrmObjectSearch) ([]oid.ID, error) { + var oids []oid.ID + + for _, obj := range t.objects { + for _, attr := range obj.Attributes() { + for _, f := range prm.Filters { + if attr.Key() == f.Header() { + switch f.Operation() { + case object.MatchStringEqual: + if attr.Value() == f.Value() { + oids = append(oids, obj.GetID()) + } + case object.MatchStringNotEqual: + if attr.Value() != f.Value() { + oids = append(oids, obj.GetID()) + } + default: + } + } + } + } + } + + return oids, nil +}