Skip to content

Commit

Permalink
layer: Fix tests
Browse files Browse the repository at this point in the history
Closes #1037.

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
  • Loading branch information
smallhive committed Dec 4, 2024
1 parent e0a3f7f commit ccebacf
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions api/layer/neofs_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit ccebacf

Please sign in to comment.