diff options
Diffstat (limited to 'store/storetest')
-rw-r--r-- | store/storetest/channel_store.go | 42 | ||||
-rw-r--r-- | store/storetest/mocks/LayeredStoreDatabaseLayer.go | 10 | ||||
-rw-r--r-- | store/storetest/mocks/SqlStore.go | 10 | ||||
-rw-r--r-- | store/storetest/mocks/Store.go | 10 | ||||
-rw-r--r-- | store/storetest/store.go | 2 |
5 files changed, 74 insertions, 0 deletions
diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go index ecec7fab9..b033e9c98 100644 --- a/store/storetest/channel_store.go +++ b/store/storetest/channel_store.go @@ -1708,6 +1708,14 @@ func testChannelStoreSearchMore(t *testing.T, ss store.Store) { o8.Type = model.CHANNEL_PRIVATE store.Must(ss.Channel().Save(&o8, -1)) + o9 := model.Channel{} + o9.TeamId = o1.TeamId + o9.DisplayName = "Channel With Purpose" + o9.Purpose = "This can now be searchable!" + o9.Name = "with-purpose" + o9.Type = model.CHANNEL_OPEN + store.Must(ss.Channel().Save(&o9, -1)) + if result := <-ss.Channel().SearchMore(m1.UserId, o1.TeamId, "ChannelA"); result.Err != nil { t.Fatal(result.Err) } else { @@ -1773,6 +1781,19 @@ func testChannelStoreSearchMore(t *testing.T, ss store.Store) { } } + if result := <-ss.Channel().SearchMore(m1.UserId, o1.TeamId, "now searchable"); result.Err != nil { + t.Fatal(result.Err) + } else { + channels := result.Data.(*model.ChannelList) + if len(*channels) != 1 { + t.Fatal("should return 1 channel") + } + + if (*channels)[0].Name != o9.Name { + t.Fatal("wrong channel returned") + } + } + /* // Disabling this check as it will fail on PostgreSQL as we have "liberalised" channel matching to deal with // Full-Text Stemming Limitations. @@ -1884,6 +1905,14 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) { o11.Type = model.CHANNEL_OPEN store.Must(ss.Channel().Save(&o11, -1)) + o12 := model.Channel{} + o12.TeamId = o1.TeamId + o12.DisplayName = "Channel With Purpose" + o12.Purpose = "This can now be searchable!" + o12.Name = "with-purpose" + o12.Type = model.CHANNEL_OPEN + store.Must(ss.Channel().Save(&o12, -1)) + for name, search := range map[string]func(teamId string, term string) store.StoreChannel{ "AutocompleteInTeam": ss.Channel().AutocompleteInTeam, "SearchInTeam": ss.Channel().SearchInTeam, @@ -1986,6 +2015,19 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) { t.Fatal("wrong channel returned") } } + + if result := <-search(o1.TeamId, "now searchable"); result.Err != nil { + t.Fatal(result.Err) + } else { + channels := result.Data.(*model.ChannelList) + if len(*channels) != 1 { + t.Fatal("should return 1 channel") + } + + if (*channels)[0].Name != o12.Name { + t.Fatal("wrong channel returned") + } + } }) } } diff --git a/store/storetest/mocks/LayeredStoreDatabaseLayer.go b/store/storetest/mocks/LayeredStoreDatabaseLayer.go index adbe1068c..47b594a81 100644 --- a/store/storetest/mocks/LayeredStoreDatabaseLayer.go +++ b/store/storetest/mocks/LayeredStoreDatabaseLayer.go @@ -200,6 +200,11 @@ func (_m *LayeredStoreDatabaseLayer) License() store.LicenseStore { return r0 } +// LockToMaster provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) LockToMaster() { + _m.Called() +} + // MarkSystemRanUnitTests provides a mock function with given fields: func (_m *LayeredStoreDatabaseLayer) MarkSystemRanUnitTests() { _m.Called() @@ -851,6 +856,11 @@ func (_m *LayeredStoreDatabaseLayer) TotalSearchDbConnections() int { return r0 } +// UnlockFromMaster provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) UnlockFromMaster() { + _m.Called() +} + // User provides a mock function with given fields: func (_m *LayeredStoreDatabaseLayer) User() store.UserStore { ret := _m.Called() diff --git a/store/storetest/mocks/SqlStore.go b/store/storetest/mocks/SqlStore.go index 021baa7d3..a0cc3f0cc 100644 --- a/store/storetest/mocks/SqlStore.go +++ b/store/storetest/mocks/SqlStore.go @@ -411,6 +411,11 @@ func (_m *SqlStore) License() store.LicenseStore { return r0 } +// LockToMaster provides a mock function with given fields: +func (_m *SqlStore) LockToMaster() { + _m.Called() +} + // MarkSystemRanUnitTests provides a mock function with given fields: func (_m *SqlStore) MarkSystemRanUnitTests() { _m.Called() @@ -706,6 +711,11 @@ func (_m *SqlStore) TotalSearchDbConnections() int { return r0 } +// UnlockFromMaster provides a mock function with given fields: +func (_m *SqlStore) UnlockFromMaster() { + _m.Called() +} + // User provides a mock function with given fields: func (_m *SqlStore) User() store.UserStore { ret := _m.Called() diff --git a/store/storetest/mocks/Store.go b/store/storetest/mocks/Store.go index dd1967cd5..3a5b7726c 100644 --- a/store/storetest/mocks/Store.go +++ b/store/storetest/mocks/Store.go @@ -198,6 +198,11 @@ func (_m *Store) License() store.LicenseStore { return r0 } +// LockToMaster provides a mock function with given fields: +func (_m *Store) LockToMaster() { + _m.Called() +} + // MarkSystemRanUnitTests provides a mock function with given fields: func (_m *Store) MarkSystemRanUnitTests() { _m.Called() @@ -437,6 +442,11 @@ func (_m *Store) TotalSearchDbConnections() int { return r0 } +// UnlockFromMaster provides a mock function with given fields: +func (_m *Store) UnlockFromMaster() { + _m.Called() +} + // User provides a mock function with given fields: func (_m *Store) User() store.UserStore { ret := _m.Called() diff --git a/store/storetest/store.go b/store/storetest/store.go index 677a63101..e73596ec4 100644 --- a/store/storetest/store.go +++ b/store/storetest/store.go @@ -77,6 +77,8 @@ func (s *Store) ChannelMemberHistory() store.ChannelMemberHistoryStore { } func (s *Store) MarkSystemRanUnitTests() { /* do nothing */ } func (s *Store) Close() { /* do nothing */ } +func (s *Store) LockToMaster() { /* do nothing */ } +func (s *Store) UnlockFromMaster() { /* do nothing */ } func (s *Store) DropAllTables() { /* do nothing */ } func (s *Store) TotalMasterDbConnections() int { return 1 } func (s *Store) TotalReadDbConnections() int { return 1 } |