summaryrefslogtreecommitdiffstats
path: root/manualtesting
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-13 13:53:37 -0500
committerGitHub <noreply@github.com>2017-01-13 13:53:37 -0500
commit97558f6a6ec4c53fa69035fb430ead209d9c222d (patch)
tree6fc57f5b75b15a025348c6e295cea6aedb9e69ae /manualtesting
parent07bad4d6d518a9012a20fec8309cd625f57c7a8c (diff)
downloadchat-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 'manualtesting')
-rw-r--r--manualtesting/manual_testing.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/manualtesting/manual_testing.go b/manualtesting/manual_testing.go
index 9a2d557bc..30249f995 100644
--- a/manualtesting/manual_testing.go
+++ b/manualtesting/manual_testing.go
@@ -4,16 +4,18 @@
package manualtesting
import (
- l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/platform/api"
- "github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"hash/fnv"
"math/rand"
"net/http"
"net/url"
"strconv"
"time"
+
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/api"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
)
type TestEnvironment struct {
@@ -27,7 +29,7 @@ type TestEnvironment struct {
}
func InitManualTesting() {
- api.Srv.Router.Handle("/manualtest", api.AppHandler(manualTest)).Methods("GET")
+ app.Srv.Router.Handle("/manualtest", api.AppHandler(manualTest)).Methods("GET")
}
func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
@@ -70,7 +72,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
Type: model.TEAM_OPEN,
}
- if result := <-api.Srv.Store.Team().Save(team); result.Err != nil {
+ if result := <-app.Srv.Store.Team().Save(team); result.Err != nil {
c.Err = result.Err
return
} else {
@@ -78,7 +80,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
createdTeam := result.Data.(*model.Team)
channel := &model.Channel{DisplayName: "Town Square", Name: "town-square", Type: model.CHANNEL_OPEN, TeamId: createdTeam.Id}
- if _, err := api.CreateChannel(c, channel, false); err != nil {
+ if _, err := app.CreateChannel(channel, false); err != nil {
c.Err = err
return
}
@@ -98,8 +100,8 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
return
}
- <-api.Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)
- <-api.Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: teamID, UserId: result.Data.(*model.User).Id})
+ <-app.Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)
+ <-app.Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: teamID, UserId: result.Data.(*model.User).Id})
newuser := result.Data.(*model.User)
userID = newuser.Id
@@ -153,7 +155,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
func getChannelID(channelname string, teamid string, userid string) (id string, err bool) {
// Grab all the channels
- result := <-api.Srv.Store.Channel().GetChannels(teamid, userid)
+ result := <-app.Srv.Store.Channel().GetChannels(teamid, userid)
if result.Err != nil {
l4g.Debug(utils.T("manaultesting.get_channel_id.unable.debug"))
return "", false