summaryrefslogtreecommitdiffstats
path: root/manualtesting
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-05-16 13:43:22 -0400
committerGitHub <noreply@github.com>2018-05-16 13:43:22 -0400
commit1f6c271b3bedd6656ae7155714423b1b39a669c1 (patch)
tree9ce6390c237cc5f7c16d63addb4372033807cff8 /manualtesting
parent02f8c18f40cd0e973e4c75b751e8fcbbbd019728 (diff)
downloadchat-1f6c271b3bedd6656ae7155714423b1b39a669c1.tar.gz
chat-1f6c271b3bedd6656ae7155714423b1b39a669c1.tar.bz2
chat-1f6c271b3bedd6656ae7155714423b1b39a669c1.zip
MM-8708 Remove api package (#8784)
* Remove api package * Remove api dependency from cmd package * Remove EnableAPIv3 setting * Update web tests * Add more websocket tests * Move some ws and oauth tests to api4 package * Move command tests into api4 package * Test fixes * Fix msg command test * Add some app file tests
Diffstat (limited to 'manualtesting')
-rw-r--r--manualtesting/manual_testing.go34
-rw-r--r--manualtesting/test_autolink.go4
2 files changed, 19 insertions, 19 deletions
diff --git a/manualtesting/manual_testing.go b/manualtesting/manual_testing.go
index 7b78fd312..2dbe61343 100644
--- a/manualtesting/manual_testing.go
+++ b/manualtesting/manual_testing.go
@@ -12,28 +12,29 @@ import (
"strconv"
"time"
- "github.com/mattermost/mattermost-server/api"
+ "github.com/mattermost/mattermost-server/api4"
"github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
+ "github.com/mattermost/mattermost-server/web"
)
type TestEnvironment struct {
Params map[string][]string
- Client *model.Client
+ Client *model.Client4
CreatedTeamId string
CreatedUserId string
- Context *api.Context
+ Context *web.Context
Writer http.ResponseWriter
Request *http.Request
}
-func Init(api3 *api.API) {
- api3.BaseRoutes.Root.Handle("/manualtest", api3.AppHandler(manualTest)).Methods("GET")
+func Init(api4 *api4.API) {
+ api4.BaseRoutes.Root.Handle("/manualtest", api4.ApiHandler(manualTest)).Methods("GET")
}
-func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
+func manualTest(c *web.Context, w http.ResponseWriter, r *http.Request) {
// Let the world know
mlog.Info("Setting up for manual test...")
@@ -56,7 +57,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
}
// Create a client for tests to use
- client := model.NewClient("http://localhost" + *c.App.Config().ServiceSettings.ListenAddress)
+ client := model.NewAPIv4Client("http://localhost" + *c.App.Config().ServiceSettings.ListenAddress)
// Check for username parameter and create a user if present
username, ok1 := params["username"]
@@ -95,22 +96,21 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
Nickname: username[0],
Password: app.USER_PASSWORD}
- result, err := client.CreateUser(user, "")
- if err != nil {
- c.Err = err
+ user, resp := client.CreateUser(user)
+ if resp.Error != nil {
+ c.Err = resp.Error
return
}
- <-c.App.Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)
- <-c.App.Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: teamID, UserId: result.Data.(*model.User).Id}, *c.App.Config().TeamSettings.MaxUsersPerTeam)
+ <-c.App.Srv.Store.User().VerifyEmail(user.Id)
+ <-c.App.Srv.Store.Team().SaveMember(&model.TeamMember{TeamId: teamID, UserId: user.Id}, *c.App.Config().TeamSettings.MaxUsersPerTeam)
- newuser := result.Data.(*model.User)
- userID = newuser.Id
+ userID = user.Id
// Login as user to generate auth token
- _, err = client.LoginById(newuser.Id, app.USER_PASSWORD)
- if err != nil {
- c.Err = err
+ _, resp = client.LoginById(user.Id, app.USER_PASSWORD)
+ if resp.Error != nil {
+ c.Err = resp.Error
return
}
diff --git a/manualtesting/test_autolink.go b/manualtesting/test_autolink.go
index 3fe589241..05fd45551 100644
--- a/manualtesting/test_autolink.go
+++ b/manualtesting/test_autolink.go
@@ -31,6 +31,6 @@ func testAutoLink(env TestEnvironment) *model.AppError {
post := &model.Post{
ChannelId: channelID,
Message: LINK_POST_TEXT}
- _, err2 := env.Client.CreatePost(post)
- return err2
+ _, resp := env.Client.CreatePost(post)
+ return resp.Error
}