2022-01-25 16:21:35 +00:00
|
|
|
package sessiontest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/rand"
|
|
|
|
|
2022-02-01 10:15:12 +00:00
|
|
|
addresstest "github.com/nspcc-dev/neofs-sdk-go/object/address/test"
|
2022-01-25 16:21:35 +00:00
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/session"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ObjectContext returns session.ObjectContext
|
|
|
|
// which applies to random operation on a random object.
|
|
|
|
func ObjectContext() *session.ObjectContext {
|
|
|
|
c := session.NewObjectContext()
|
|
|
|
|
|
|
|
setters := []func(){
|
|
|
|
c.ForPut,
|
|
|
|
c.ForDelete,
|
|
|
|
c.ForHead,
|
|
|
|
c.ForRange,
|
|
|
|
c.ForRangeHash,
|
|
|
|
c.ForSearch,
|
|
|
|
c.ForGet,
|
|
|
|
}
|
|
|
|
|
|
|
|
setters[rand.Uint32()%uint32(len(setters))]()
|
|
|
|
|
2022-02-01 10:15:12 +00:00
|
|
|
c.ApplyTo(addresstest.Address())
|
2022-01-25 16:21:35 +00:00
|
|
|
|
|
|
|
return c
|
|
|
|
}
|