Merge branch 'master' into MM-47853-true-up-review-telemetry-off-non-air-gapped
Этот коммит содержится в:
@@ -321,6 +321,16 @@ func (l *License) HasEnterpriseMarketplacePlugins() bool {
|
||||
l.SkuShortName == LicenseShortSkuEnterprise
|
||||
}
|
||||
|
||||
func (l *License) HasSharedChannels() bool {
|
||||
if l == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return (l.Features != nil && l.Features.SharedChannels != nil && *l.Features.SharedChannels) ||
|
||||
l.SkuShortName == LicenseShortSkuProfessional ||
|
||||
l.SkuShortName == LicenseShortSkuEnterprise
|
||||
}
|
||||
|
||||
// NewTestLicense returns a license that expires in the future and has the given features.
|
||||
func NewTestLicense(features ...string) *License {
|
||||
ret := &License{
|
||||
|
||||
@@ -343,3 +343,53 @@ func TestLicense_IsSanctionedTrial(t *testing.T) {
|
||||
assert.True(t, license.IsSanctionedTrial())
|
||||
})
|
||||
}
|
||||
|
||||
func TestLicenseHasSharedChannels(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
description string
|
||||
license License
|
||||
expectedValue bool
|
||||
}{
|
||||
{
|
||||
"licensed for shared channels",
|
||||
License{
|
||||
Features: &Features{
|
||||
SharedChannels: NewBool(true),
|
||||
},
|
||||
SkuShortName: "other",
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"not licensed for shared channels",
|
||||
License{
|
||||
Features: &Features{},
|
||||
SkuShortName: "other",
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"professional license for shared channels",
|
||||
License{
|
||||
Features: &Features{},
|
||||
SkuShortName: LicenseShortSkuProfessional,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"enterprise license for shared channels",
|
||||
License{
|
||||
Features: &Features{},
|
||||
SkuShortName: LicenseShortSkuEnterprise,
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.expectedValue, testCase.license.HasSharedChannels())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user