forked from TrueCloudLab/frostfs-api-go
32dd0bb3f9
Define constant for `WrongMagicNumber` local code. Define constant `DetailIDCorrect` for correct magic detail. Add `ResetDetails` and `AppendDetails` method pair. Replace `SetDetails` method with new `SetStatusDetails` function which can be implemented using new methods. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
44 lines
797 B
Go
44 lines
797 B
Go
package statustest
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/v2/status"
|
|
)
|
|
|
|
// Detail returns status.Detail filled with static random values.
|
|
func Detail(empty bool) *status.Detail {
|
|
m := new(status.Detail)
|
|
|
|
if !empty {
|
|
m.SetID(345)
|
|
m.SetValue([]byte("value"))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// Details returns several status.Detail messages filled with static random values.
|
|
func Details(empty bool) []*status.Detail {
|
|
var res []*status.Detail
|
|
|
|
if !empty {
|
|
res = append(res,
|
|
Detail(false),
|
|
Detail(false),
|
|
)
|
|
}
|
|
|
|
return res
|
|
}
|
|
|
|
// Status returns status.Status messages filled with static random values.
|
|
func Status(empty bool) *status.Status {
|
|
m := new(status.Status)
|
|
|
|
if !empty {
|
|
m.SetCode(765)
|
|
m.SetMessage("some string")
|
|
status.SetStatusDetails(m, Details(false))
|
|
}
|
|
|
|
return m
|
|
}
|