Files
team/server/channels/store/storetest/mocks/AutoTranslationStore.go
66b169b93c MM-65756 Database Migrations, Indexes and Methods for Auto-Translation (#34047)
* AutoTranslate config settings

* comment out Agents provider

* Add auto translate timeout config validation

* i18n messages for autotranslation config validation

* fix test

* validate url for libreTranslate

* Feedback review

* Admin Console UI for Auto-Translation

* fix admin console conditional section display

* i18n

* removed unintentional change

* update admin.general.localization.autoTranslateProviderDescription newline

* fix lint

* Fix types

* UX feedback review

* fix typo in i18n

* Fix AutoTranslation feature flag

* feedback review

* Fix test default values

* feedback review

* re-add isHidden property to feature discovery

* Database Migrations, Indexes and Methods for Auto-Translation

* i18n

* fix retrylayer and storetest

* Fix search query

* fix lint

* remove the request.CTX and modify Translation model

* fix lint and external url

* Add settings to playwright

* Add empty as a valid value for the Provider

* Update jsonb queries

* Fix queries and add model methods

* fix go lint

* go lint fix 2

* fix db migrations

* feedback review + store cache

* increase migration number

* cleanup autotranslation store cache

* use NULL as objectType for posts

* fix bad merge

* fix tests

* add missing i18n

* Switch prop bags column to boolean

* fix lint

* fix tests

* Remove database search

* use Builder methods

---------

Co-authored-by: BenCookie95 <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2025-11-22 09:32:01 +08:00

259 lines
6.9 KiB
Go

// Code generated by mockery v2.53.4. DO NOT EDIT.
// Regenerate this file using `make store-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// AutoTranslationStore is an autogenerated mock type for the AutoTranslationStore type
type AutoTranslationStore struct {
mock.Mock
}
// ClearCaches provides a mock function with no fields
func (_m *AutoTranslationStore) ClearCaches() {
_m.Called()
}
// Get provides a mock function with given fields: objectID, dstLang
func (_m *AutoTranslationStore) Get(objectID string, dstLang string) (*model.Translation, *model.AppError) {
ret := _m.Called(objectID, dstLang)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 *model.Translation
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (*model.Translation, *model.AppError)); ok {
return rf(objectID, dstLang)
}
if rf, ok := ret.Get(0).(func(string, string) *model.Translation); ok {
r0 = rf(objectID, dstLang)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Translation)
}
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(objectID, dstLang)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetActiveDestinationLanguages provides a mock function with given fields: channelID, excludeUserID, filterUserIDs
func (_m *AutoTranslationStore) GetActiveDestinationLanguages(channelID string, excludeUserID string, filterUserIDs []string) ([]string, *model.AppError) {
ret := _m.Called(channelID, excludeUserID, filterUserIDs)
if len(ret) == 0 {
panic("no return value specified for GetActiveDestinationLanguages")
}
var r0 []string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string, []string) ([]string, *model.AppError)); ok {
return rf(channelID, excludeUserID, filterUserIDs)
}
if rf, ok := ret.Get(0).(func(string, string, []string) []string); ok {
r0 = rf(channelID, excludeUserID, filterUserIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(string, string, []string) *model.AppError); ok {
r1 = rf(channelID, excludeUserID, filterUserIDs)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetUserLanguage provides a mock function with given fields: userID, channelID
func (_m *AutoTranslationStore) GetUserLanguage(userID string, channelID string) (string, *model.AppError) {
ret := _m.Called(userID, channelID)
if len(ret) == 0 {
panic("no return value specified for GetUserLanguage")
}
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (string, *model.AppError)); ok {
return rf(userID, channelID)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(userID, channelID)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(userID, channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// InvalidateUserAutoTranslation provides a mock function with given fields: userID, channelID
func (_m *AutoTranslationStore) InvalidateUserAutoTranslation(userID string, channelID string) {
_m.Called(userID, channelID)
}
// InvalidateUserLocaleCache provides a mock function with given fields: userID
func (_m *AutoTranslationStore) InvalidateUserLocaleCache(userID string) {
_m.Called(userID)
}
// IsChannelEnabled provides a mock function with given fields: channelID
func (_m *AutoTranslationStore) IsChannelEnabled(channelID string) (bool, *model.AppError) {
ret := _m.Called(channelID)
if len(ret) == 0 {
panic("no return value specified for IsChannelEnabled")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (bool, *model.AppError)); ok {
return rf(channelID)
}
if rf, ok := ret.Get(0).(func(string) bool); ok {
r0 = rf(channelID)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// IsUserEnabled provides a mock function with given fields: userID, channelID
func (_m *AutoTranslationStore) IsUserEnabled(userID string, channelID string) (bool, *model.AppError) {
ret := _m.Called(userID, channelID)
if len(ret) == 0 {
panic("no return value specified for IsUserEnabled")
}
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (bool, *model.AppError)); ok {
return rf(userID, channelID)
}
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
r0 = rf(userID, channelID)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(userID, channelID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// Save provides a mock function with given fields: translation
func (_m *AutoTranslationStore) Save(translation *model.Translation) *model.AppError {
ret := _m.Called(translation)
if len(ret) == 0 {
panic("no return value specified for Save")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.Translation) *model.AppError); ok {
r0 = rf(translation)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// SetChannelEnabled provides a mock function with given fields: channelID, enabled
func (_m *AutoTranslationStore) SetChannelEnabled(channelID string, enabled bool) *model.AppError {
ret := _m.Called(channelID, enabled)
if len(ret) == 0 {
panic("no return value specified for SetChannelEnabled")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, bool) *model.AppError); ok {
r0 = rf(channelID, enabled)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// SetUserEnabled provides a mock function with given fields: userID, channelID, enabled
func (_m *AutoTranslationStore) SetUserEnabled(userID string, channelID string, enabled bool) *model.AppError {
ret := _m.Called(userID, channelID, enabled)
if len(ret) == 0 {
panic("no return value specified for SetUserEnabled")
}
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string, bool) *model.AppError); ok {
r0 = rf(userID, channelID, enabled)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// NewAutoTranslationStore creates a new instance of AutoTranslationStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewAutoTranslationStore(t interface {
mock.TestingT
Cleanup(func())
}) *AutoTranslationStore {
mock := &AutoTranslationStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}