2022-02-21 17:57:27 +00:00
|
|
|
package object_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/status"
|
|
|
|
statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStatusCodes(t *testing.T) {
|
|
|
|
statustest.TestCodes(t, object.LocalizeFailStatus, object.GlobalizeFail,
|
|
|
|
object.StatusAccessDenied, 2048,
|
|
|
|
object.StatusNotFound, 2049,
|
|
|
|
object.StatusLocked, 2050,
|
|
|
|
object.StatusLockNonRegularObject, 2051,
|
|
|
|
object.StatusAlreadyRemoved, 2052,
|
2022-06-29 17:20:41 +00:00
|
|
|
object.StatusOutOfRange, 2053,
|
2022-02-21 17:57:27 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAccessDeniedDesc(t *testing.T) {
|
|
|
|
var st status.Status
|
|
|
|
|
|
|
|
require.Empty(t, object.ReadAccessDeniedDesc(st))
|
|
|
|
|
|
|
|
const desc = "some description"
|
|
|
|
|
|
|
|
object.WriteAccessDeniedDesc(&st, desc)
|
|
|
|
require.Equal(t, desc, object.ReadAccessDeniedDesc(st))
|
|
|
|
|
|
|
|
object.WriteAccessDeniedDesc(&st, desc+"1")
|
|
|
|
require.Equal(t, desc+"1", object.ReadAccessDeniedDesc(st))
|
|
|
|
}
|