package apemanager_test

import (
	"testing"

	"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
	"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status"
	statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test"
	"github.com/stretchr/testify/require"
)

func TestStatusCodes(t *testing.T) {
	statustest.TestCodes(t, apemanager.LocalizeFailStatus, apemanager.GlobalizeFail,
		apemanager.StatusAPEManagerAccessDenied, 5120,
	)
}

func TestAccessDeniedDesc(t *testing.T) {
	var st status.Status

	require.Empty(t, apemanager.ReadAccessDeniedDesc(st))

	const desc = "some description"

	apemanager.WriteAccessDeniedDesc(&st, desc)
	require.Equal(t, desc, apemanager.ReadAccessDeniedDesc(st))

	apemanager.WriteAccessDeniedDesc(&st, desc+"1")
	require.Equal(t, desc+"1", apemanager.ReadAccessDeniedDesc(st))
}