AccessControl: Replace IsEnterprise checks with license checks (#49572) (#49646)

(cherry picked from commit 5caf97be40)

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-05-25 20:59:47 +02:00
committed by GitHub
co-authored by Karl Persson
parent 1d4e2d12da
commit 4bd6f62dfd
11 changed files with 98 additions and 25 deletions
@@ -0,0 +1,52 @@
package licensingtest
import (
"github.com/stretchr/testify/mock"
"github.com/grafana/grafana/pkg/models"
)
var _ models.Licensing = new(FakeLicensing)
func NewFakeLicensing() *FakeLicensing {
return &FakeLicensing{&mock.Mock{}}
}
type FakeLicensing struct {
*mock.Mock
}
func (f *FakeLicensing) Expiry() int64 {
mockedArgs := f.Called()
return mockedArgs.Get(0).(int64)
}
func (f *FakeLicensing) Edition() string {
mockedArgs := f.Called()
return mockedArgs.Get(0).(string)
}
func (f *FakeLicensing) ContentDeliveryPrefix() string {
mockedArgs := f.Called()
return mockedArgs.Get(0).(string)
}
func (f *FakeLicensing) LicenseURL(showAdminLicensingPage bool) string {
mockedArgs := f.Called(showAdminLicensingPage)
return mockedArgs.Get(0).(string)
}
func (f *FakeLicensing) StateInfo() string {
mockedArgs := f.Called()
return mockedArgs.Get(0).(string)
}
func (f *FakeLicensing) EnabledFeatures() map[string]bool {
mockedArgs := f.Called()
return mockedArgs.Get(0).(map[string]bool)
}
func (f *FakeLicensing) FeatureEnabled(feature string) bool {
mockedArgs := f.Called(feature)
return mockedArgs.Get(0).(bool)
}