Migrate to stateless app.App (#17542)
* add request context * move initialialization to server * use app interface instead of global app functions * remove app context from webconn * cleanup * remove duplicated services * move context to separate package * remove finalize init method and move content to NewServer function * restart workers and schedulers after adding license for tests * reflect review comments Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c09369f14a
Коммит
5ea06e51d0
@@ -194,7 +194,7 @@ func TestSaveReaction(t *testing.T) {
|
||||
EmojiName: "smile",
|
||||
}
|
||||
|
||||
err := th.App.DeleteChannel(channel, userId)
|
||||
err := th.App.DeleteChannel(th.Context, channel, userId)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, resp := Client.SaveReaction(reaction)
|
||||
@@ -324,7 +324,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
}()
|
||||
|
||||
t.Run("delete-reaction", func(t *testing.T) {
|
||||
th.App.SaveReactionForPost(r1)
|
||||
th.App.SaveReactionForPost(th.Context, r1)
|
||||
reactions, err := th.App.GetReactionsForPost(postId)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, 1, len(reactions), "didn't save reaction correctly")
|
||||
@@ -340,8 +340,8 @@ func TestDeleteReaction(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("delete-reaction-when-post-has-multiple-reactions", func(t *testing.T) {
|
||||
th.App.SaveReactionForPost(r1)
|
||||
th.App.SaveReactionForPost(r2)
|
||||
th.App.SaveReactionForPost(th.Context, r1)
|
||||
th.App.SaveReactionForPost(th.Context, r2)
|
||||
reactions, err := th.App.GetReactionsForPost(postId)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(reactions), 2, "didn't save reactions correctly")
|
||||
@@ -356,7 +356,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("delete-reaction-when-plus-one-reaction-name", func(t *testing.T) {
|
||||
th.App.SaveReactionForPost(r3)
|
||||
th.App.SaveReactionForPost(th.Context, r3)
|
||||
reactions, err := th.App.GetReactionsForPost(postId)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, 2, len(reactions), "didn't save reactions correctly")
|
||||
@@ -372,7 +372,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
|
||||
t.Run("delete-reaction-made-by-another-user", func(t *testing.T) {
|
||||
th.LoginBasic2()
|
||||
th.App.SaveReactionForPost(r4)
|
||||
th.App.SaveReactionForPost(th.Context, r4)
|
||||
reactions, err := th.App.GetReactionsForPost(postId)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, 2, len(reactions), "didn't save reaction correctly")
|
||||
@@ -456,7 +456,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
th.LoginBasic()
|
||||
|
||||
th.RemovePermissionFromRole(model.PERMISSION_REMOVE_REACTION.Id, model.CHANNEL_USER_ROLE_ID)
|
||||
th.App.SaveReactionForPost(r1)
|
||||
th.App.SaveReactionForPost(th.Context, r1)
|
||||
|
||||
_, resp := Client.DeleteReaction(r1)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -469,7 +469,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
|
||||
t.Run("unable-to-delete-others-reactions-without-permissions", func(t *testing.T) {
|
||||
th.RemovePermissionFromRole(model.PERMISSION_REMOVE_OTHERS_REACTIONS.Id, model.SYSTEM_ADMIN_ROLE_ID)
|
||||
th.App.SaveReactionForPost(r1)
|
||||
th.App.SaveReactionForPost(th.Context, r1)
|
||||
|
||||
_, resp := th.SystemAdminClient.DeleteReaction(r1)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -534,7 +534,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, 1, len(reactions), "should have created a reaction")
|
||||
|
||||
err = th.App.DeleteChannel(channel, userId)
|
||||
err = th.App.DeleteChannel(th.Context, channel, userId)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, resp = Client.SaveReaction(r1)
|
||||
|
||||
Ссылка в новой задаче
Block a user