MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)

* Generate and use an interface instead of *App
Этот коммит содержится в:
Eli Yukelzon
2020-02-13 13:26:58 +01:00
коммит произвёл GitHub
родитель 66fc096768
Коммит 17523fa5d9
200 изменённых файлов: 4553 добавлений и 2361 удалений

Просмотреть файл

@@ -89,7 +89,7 @@ func TestExportUserChannels(t *testing.T) {
}
var preferences model.Preferences
preferences = append(preferences, preference)
err := th.App.Srv.Store.Preference().Save(&preferences)
err := th.App.Srv().Store.Preference().Save(&preferences)
require.Nil(t, err)
th.App.UpdateChannelMemberNotifyProps(notifyProps, channel.Id, user.Id)
@@ -231,7 +231,7 @@ func TestExportDMChannel(t *testing.T) {
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
require.Nil(t, err)
channels, err := th1.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err := th1.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 1, len(channels))
@@ -240,7 +240,7 @@ func TestExportDMChannel(t *testing.T) {
th2 := Setup(t)
defer th2.TearDown()
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 0, len(channels))
@@ -250,7 +250,7 @@ func TestExportDMChannel(t *testing.T) {
assert.Equal(t, 0, i)
// Ensure the Members of the imported DM channel is the same was from the exported
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 1, len(channels))
assert.ElementsMatch(t, []string{th1.BasicUser.Username, th1.BasicUser2.Username}, *channels[0].Members)
@@ -267,14 +267,14 @@ func TestExportDMChannelToSelf(t *testing.T) {
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
require.Nil(t, err)
channels, err := th1.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err := th1.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 1, len(channels))
th2 := Setup(t)
defer th2.TearDown()
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 0, len(channels))
@@ -283,7 +283,7 @@ func TestExportDMChannelToSelf(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 0, i)
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 1, len(channels))
assert.Equal(t, 1, len((*channels[0].Members)))
@@ -305,7 +305,7 @@ func TestExportGMChannel(t *testing.T) {
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
require.Nil(t, err)
channels, err := th1.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err := th1.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 1, len(channels))
@@ -314,7 +314,7 @@ func TestExportGMChannel(t *testing.T) {
th2 := Setup(t)
defer th2.TearDown()
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 0, len(channels))
}
@@ -337,7 +337,7 @@ func TestExportGMandDMChannels(t *testing.T) {
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
require.Nil(t, err)
channels, err := th1.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err := th1.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 2, len(channels))
@@ -346,7 +346,7 @@ func TestExportGMandDMChannels(t *testing.T) {
th2 := Setup(t)
defer th2.TearDown()
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
assert.Equal(t, 0, len(channels))
@@ -356,7 +356,7 @@ func TestExportGMandDMChannels(t *testing.T) {
assert.Equal(t, 0, i)
// Ensure the Members of the imported GM channel is the same was from the exported
channels, err = th2.App.Srv.Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
channels, err = th2.App.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, "00000000")
require.Nil(t, err)
// Adding some deteminism so its possible to assert on slice index
@@ -412,7 +412,7 @@ func TestExportDMandGMPost(t *testing.T) {
}
th1.App.CreatePost(p4, gmChannel, false)
posts, err := th1.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err := th1.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 4, len(posts))
@@ -425,7 +425,7 @@ func TestExportDMandGMPost(t *testing.T) {
th2 := Setup(t)
defer th2.TearDown()
posts, err = th2.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err = th2.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 0, len(posts))
@@ -434,7 +434,7 @@ func TestExportDMandGMPost(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 0, i)
posts, err = th2.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err = th2.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
// Adding some deteminism so its possible to assert on slice index
@@ -458,7 +458,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
require.Nil(t, err)
posts, err := th1.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err := th1.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 1, len(posts))
@@ -467,7 +467,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
th2 := Setup(t)
defer th2.TearDown()
posts, err = th2.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err = th2.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 0, len(posts))
@@ -476,7 +476,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 0, i)
posts, err = th2.App.Srv.Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
posts, err = th2.App.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, "0000000")
require.Nil(t, err)
assert.Equal(t, 1, len(posts))
assert.Equal(t, 1, len((*posts[0].ChannelMembers)))