diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-13 13:53:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-13 13:53:37 -0500 |
commit | 97558f6a6ec4c53fa69035fb430ead209d9c222d (patch) | |
tree | 6fc57f5b75b15a025348c6e295cea6aedb9e69ae /api/command_loadtest.go | |
parent | 07bad4d6d518a9012a20fec8309cd625f57c7a8c (diff) | |
download | chat-97558f6a6ec4c53fa69035fb430ead209d9c222d.tar.gz chat-97558f6a6ec4c53fa69035fb430ead209d9c222d.tar.bz2 chat-97558f6a6ec4c53fa69035fb430ead209d9c222d.zip |
PLT-4938 Add app package and move logic over from api package (#4931)
* Add app package and move logic over from api package
* Change app package functions to return errors
* Move non-api tests into app package
* Fix merge
Diffstat (limited to 'api/command_loadtest.go')
-rw-r--r-- | api/command_loadtest.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/api/command_loadtest.go b/api/command_loadtest.go index ed3fc37ba..5ad2736a0 100644 --- a/api/command_loadtest.go +++ b/api/command_loadtest.go @@ -11,6 +11,7 @@ import ( "strings" l4g "github.com/alecthomas/log4go" + "github.com/mattermost/platform/app" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" ) @@ -185,7 +186,7 @@ func (me *LoadTestProvider) SetupCommand(c *Context, channelId string, message s } else { var team *model.Team - if tr := <-Srv.Store.Team().Get(c.TeamId); tr.Err != nil { + if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil { return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } else { team = tr.Data.(*model.Team) @@ -220,7 +221,7 @@ func (me *LoadTestProvider) UsersCommand(c *Context, channelId string, message s } var team *model.Team - if tr := <-Srv.Store.Team().Get(c.TeamId); tr.Err != nil { + if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil { return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } else { team = tr.Data.(*model.Team) @@ -250,7 +251,7 @@ func (me *LoadTestProvider) ChannelsCommand(c *Context, channelId string, messag } var team *model.Team - if tr := <-Srv.Store.Team().Get(c.TeamId); tr.Err != nil { + if tr := <-app.Srv.Store.Team().Get(c.TeamId); tr.Err != nil { return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } else { team = tr.Data.(*model.Team) @@ -289,7 +290,7 @@ func (me *LoadTestProvider) PostsCommand(c *Context, channelId string, message s } var usernames []string - if result := <-Srv.Store.User().GetProfiles(c.TeamId, 0, 1000); result.Err == nil { + if result := <-app.Srv.Store.User().GetProfiles(c.TeamId, 0, 1000); result.Err == nil { profileUsers := result.Data.(map[string]*model.User) usernames = make([]string, len(profileUsers)) i := 0 @@ -358,7 +359,7 @@ func (me *LoadTestProvider) UrlCommand(c *Context, channelId string, message str post.ChannelId = channelId post.UserId = c.Session.UserId - if _, err := CreatePost(c, post, false); err != nil { + if _, err := app.CreatePost(post, c.TeamId, false); err != nil { return &model.CommandResponse{Text: "Unable to create post", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } } @@ -397,7 +398,7 @@ func (me *LoadTestProvider) JsonCommand(c *Context, channelId string, message st post.Message = message } - if _, err := CreatePost(c, post, false); err != nil { + if _, err := app.CreatePost(post, c.TeamId, false); err != nil { return &model.CommandResponse{Text: "Unable to create post", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } return &model.CommandResponse{Text: "Loaded data", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} |