hi-server/internal/logic/public/subscribe/queryUserSubscribeNodeListLogic_test.go
shanshanzhong 4349a7ea2f
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m16s
家庭组 权益修改
2026-03-04 22:02:42 -08:00

26 lines
723 B
Go

package subscribe
import (
"testing"
commonLogic "github.com/perfect-panel/server/internal/logic/common"
"github.com/perfect-panel/server/internal/types"
"github.com/stretchr/testify/require"
)
func TestFillUserSubscribeInfoEntitlementFields(t *testing.T) {
sub := &types.UserSubscribeInfo{}
entitlement := &commonLogic.EntitlementContext{
EffectiveUserID: 3001,
Source: commonLogic.EntitlementSourceFamilyOwner,
OwnerUserID: 3001,
ReadOnly: true,
}
fillUserSubscribeInfoEntitlementFields(sub, entitlement)
require.Equal(t, commonLogic.EntitlementSourceFamilyOwner, sub.EntitlementSource)
require.Equal(t, int64(3001), sub.EntitlementOwnerUserId)
require.True(t, sub.ReadOnly)
}