Premium SKU (#30396)
* Added premium SKU * removed duplicate enterprise license check functions * Added license check on API layer * lint fix * lint fix * refactured signature: * test: Add comprehensive tests for license tier check functions * fixed test * text update * optimised license checks * fixedf test * Updated license valid function * webapp license checks * handling prekium SKU in webappp: * added plugin api method and general refactoring * Updated tests --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
21ca303b5e
Коммит
a9f09cadc2
@@ -485,3 +485,189 @@ func TestLicenseHasSharedChannels(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinimumProfessionalLicense(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
license *License
|
||||
expectedValue bool
|
||||
}{
|
||||
{
|
||||
"nil license",
|
||||
nil,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"professional license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuProfessional,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"enterprise license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuEnterprise,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"premium license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuPremium,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"E10 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE10,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"E20 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE20,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"unknown license",
|
||||
&License{
|
||||
SkuShortName: "unknown",
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.expectedValue, MinimumProfessionalLicense(testCase.license))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinimumEnterpriseLicense(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
license *License
|
||||
expectedValue bool
|
||||
}{
|
||||
{
|
||||
"nil license",
|
||||
nil,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"professional license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuProfessional,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"enterprise license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuEnterprise,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"premium license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuPremium,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"E10 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE10,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"E20 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE20,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"unknown license",
|
||||
&License{
|
||||
SkuShortName: "unknown",
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.expectedValue, MinimumEnterpriseLicense(testCase.license))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinimumPremiumLicense(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
license *License
|
||||
expectedValue bool
|
||||
}{
|
||||
{
|
||||
"nil license",
|
||||
nil,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"professional license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuProfessional,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"enterprise license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuEnterprise,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"premium license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuPremium,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"E10 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE10,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"E20 license",
|
||||
&License{
|
||||
SkuShortName: LicenseShortSkuE20,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"unknown license",
|
||||
&License{
|
||||
SkuShortName: "unknown",
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.expectedValue, MinimumPremiumLicense(testCase.license))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user