frostfs-sdk-go/client/status/object_test.go
Evgenii Baidakov e7a5728d6b
client: Rename FromStatusV2 to ErrorFromV2, ToStatusV2 to ErrorToV2
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-05-24 13:41:58 +04:00

26 lines
570 B
Go

package apistatus_test
import (
"testing"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
"github.com/stretchr/testify/require"
)
func TestObjectAccessDenied_WriteReason(t *testing.T) {
const reason = "any reason"
var st apistatus.ObjectAccessDenied
res := st.Reason()
require.Empty(t, res)
detailNum := apistatus.ErrorToV2(st).NumberOfDetails()
require.Zero(t, detailNum)
st.WriteReason(reason)
res = st.Reason()
require.Equal(t, reason, res)
detailNum = apistatus.ErrorToV2(st).NumberOfDetails()
require.EqualValues(t, 1, detailNum)
}