teststore.go
TLDR
This file contains a TestStore
struct that represents a test implementation of the store.Store
interface. The struct has two methods: NewTestEnterpriseStore
and NewTestProfessionalStore
, which create instances of the TestStore
struct with different sets of features in the license. The GetLicense
method returns the license associated with the test store.
Methods
NewTestEnterpriseStore
This method creates a new instance of the TestStore
struct with enterprise-level features enabled in the license. It takes a store.Store
parameter and returns a pointer to the created TestStore
instance.
NewTestProfessionalStore
This method creates a new instance of the TestStore
struct with professional-level features enabled in the license. It takes a store.Store
parameter and returns a pointer to the created TestStore
instance.
GetLicense
This method returns the license associated with the test store. It returns a pointer to the mmModel.License
struct.
package integrationtests
import (
"github.com/mattermost/focalboard/server/services/store"
mmModel "github.com/mattermost/mattermost-server/v6/model"
)
type TestStore struct {
store.Store
license *mmModel.License
}
func NewTestEnterpriseStore(store store.Store) *TestStore {
usersValue := 10000
trueValue := true
falseValue := false
license := &mmModel.License{
Features: &mmModel.Features{
Users: &usersValue,
LDAP: &trueValue,
LDAPGroups: &trueValue,
MFA: &trueValue,
GoogleOAuth: &trueValue,
Office365OAuth: &trueValue,
OpenId: &trueValue,
Compliance: &trueValue,
Cluster: &trueValue,
Metrics: &trueValue,
MHPNS: &trueValue,
SAML: &trueValue,
Elasticsearch: &trueValue,
Announcement: &trueValue,
ThemeManagement: &trueValue,
EmailNotificationContents: &trueValue,
DataRetention: &trueValue,
MessageExport: &trueValue,
CustomPermissionsSchemes: &trueValue,
CustomTermsOfService: &trueValue,
GuestAccounts: &trueValue,
GuestAccountsPermissions: &trueValue,
IDLoadedPushNotifications: &trueValue,
LockTeammateNameDisplay: &trueValue,
EnterprisePlugins: &trueValue,
AdvancedLogging: &trueValue,
Cloud: &falseValue,
SharedChannels: &trueValue,
RemoteClusterService: &trueValue,
FutureFeatures: &trueValue,
},
}
testStore := &TestStore{
Store: store,
license: license,
}
return testStore
}
func NewTestProfessionalStore(store store.Store) *TestStore {
usersValue := 10000
trueValue := true
falseValue := false
license := &mmModel.License{
Features: &mmModel.Features{
Users: &usersValue,
LDAP: &falseValue,
LDAPGroups: &falseValue,
MFA: &trueValue,
GoogleOAuth: &trueValue,
Office365OAuth: &trueValue,
OpenId: &trueValue,
Compliance: &falseValue,
Cluster: &falseValue,
Metrics: &trueValue,
MHPNS: &trueValue,
SAML: &trueValue,
Elasticsearch: &trueValue,
Announcement: &trueValue,
ThemeManagement: &trueValue,
EmailNotificationContents: &trueValue,
DataRetention: &trueValue,
MessageExport: &trueValue,
CustomPermissionsSchemes: &trueValue,
CustomTermsOfService: &trueValue,
GuestAccounts: &trueValue,
GuestAccountsPermissions: &trueValue,
IDLoadedPushNotifications: &trueValue,
LockTeammateNameDisplay: &trueValue,
EnterprisePlugins: &falseValue,
AdvancedLogging: &trueValue,
Cloud: &falseValue,
SharedChannels: &trueValue,
RemoteClusterService: &falseValue,
FutureFeatures: &trueValue,
},
}
testStore := &TestStore{
Store: store,
license: license,
}
return testStore
}
func (s *TestStore) GetLicense() *mmModel.License {
return s.license
}