2022-02-28 08:39:22 +00:00
|
|
|
package apistatus_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-07 11:20:03 +00:00
|
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
2022-02-28 08:39:22 +00:00
|
|
|
"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.ToStatusV2(st).NumberOfDetails()
|
|
|
|
require.Zero(t, detailNum)
|
|
|
|
|
|
|
|
st.WriteReason(reason)
|
|
|
|
|
|
|
|
res = st.Reason()
|
|
|
|
require.Equal(t, reason, res)
|
|
|
|
detailNum = apistatus.ToStatusV2(st).NumberOfDetails()
|
|
|
|
require.EqualValues(t, 1, detailNum)
|
|
|
|
}
|