All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m16s
26 lines
723 B
Go
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)
|
|
}
|