From 3ec5419092135f494fd04701b5cbbd15920e667b Mon Sep 17 00:00:00 2001 From: wiggin77 Date: Mon, 20 Mar 2023 13:29:30 -0400 Subject: [PATCH] add plugin mock to TestUnitUpdateConfig --- server/channels/app/app_test.go | 4 ++++ server/channels/app/helper_test.go | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/channels/app/app_test.go b/server/channels/app/app_test.go index 191aaac4da1..b0c36b54015 100644 --- a/server/channels/app/app_test.go +++ b/server/channels/app/app_test.go @@ -41,6 +41,9 @@ func TestUnitUpdateConfig(t *testing.T) { th := SetupWithStoreMock(t) defer th.TearDown() + pluginMock := mocks.PluginStore{} + pluginMock.On("Get", mock.AnythingOfType("string"), mock.AnythingOfType("string")).Return(&model.PluginKeyValue{}, nil) + mockStore := th.App.Srv().Store().(*mocks.Store) mockUserStore := mocks.UserStore{} mockUserStore.On("Count", mock.Anything).Return(int64(10), nil) @@ -57,6 +60,7 @@ func TestUnitUpdateConfig(t *testing.T) { mockStore.On("System").Return(&mockSystemStore) mockStore.On("License").Return(&mockLicenseStore) mockStore.On("GetDBSchemaVersion").Return(1, nil) + mockStore.On("Plugin").Return(&pluginMock).Maybe() prev := *th.App.Config().ServiceSettings.SiteURL diff --git a/server/channels/app/helper_test.go b/server/channels/app/helper_test.go index 66fc8ce65ec..ace4fb22d7b 100644 --- a/server/channels/app/helper_test.go +++ b/server/channels/app/helper_test.go @@ -177,14 +177,9 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper { statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) statusMock.On("UpdateLastActivityAt", "user1", mock.Anything).Return(nil) statusMock.On("SaveOrUpdate", mock.AnythingOfType("*model.Status")).Return(nil) - - pluginMock := mocks.PluginStore{} - pluginMock.On("Get", mock.AnythingOfType("string"), mock.AnythingOfType("string")).Return(&model.PluginKeyValue{}, nil) - emptyMockStore := mocks.Store{} emptyMockStore.On("Close").Return(nil) emptyMockStore.On("Status").Return(&statusMock) - emptyMockStore.On("Plugin").Return(&pluginMock).Maybe() th.App.Srv().SetStore(&emptyMockStore) return th