golint fix (#13613)
Этот коммит содержится в:
коммит произвёл
Ben Schumacher
родитель
2186af4d13
Коммит
3865bc501e
@@ -19,16 +19,18 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/web"
|
||||
)
|
||||
|
||||
// TestEnvironment is a helper struct used for tests in manualtesting.
|
||||
type TestEnvironment struct {
|
||||
Params map[string][]string
|
||||
Client *model.Client4
|
||||
CreatedTeamId string
|
||||
CreatedUserId string
|
||||
CreatedTeamID string
|
||||
CreatedUserID string
|
||||
Context *web.Context
|
||||
Writer http.ResponseWriter
|
||||
Request *http.Request
|
||||
}
|
||||
|
||||
// Init adds manualtest endpoint to the API.
|
||||
func Init(api4 *api4.API) {
|
||||
api4.BaseRoutes.Root.Handle("/manualtest", api4.ApiHandler(manualTest)).Methods("GET")
|
||||
}
|
||||
@@ -73,19 +75,20 @@ func manualTest(c *web.Context, w http.ResponseWriter, r *http.Request) {
|
||||
Type: model.TEAM_OPEN,
|
||||
}
|
||||
|
||||
if createdTeam, err := c.App.Srv.Store.Team().Save(team); err != nil {
|
||||
createdTeam, err := c.App.Srv.Store.Team().Save(team)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
} else {
|
||||
channel := &model.Channel{DisplayName: "Town Square", Name: "town-square", Type: model.CHANNEL_OPEN, TeamId: createdTeam.Id}
|
||||
if _, err := c.App.CreateChannel(channel, false); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
teamID = createdTeam.Id
|
||||
}
|
||||
|
||||
channel := &model.Channel{DisplayName: "Town Square", Name: "town-square", Type: model.CHANNEL_OPEN, TeamId: createdTeam.Id}
|
||||
if _, err := c.App.CreateChannel(channel, false); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
teamID = createdTeam.Id
|
||||
|
||||
// Create user for testing
|
||||
user := &model.User{
|
||||
Email: "success+" + model.NewId() + "simulator.amazonses.com",
|
||||
@@ -126,8 +129,8 @@ func manualTest(c *web.Context, w http.ResponseWriter, r *http.Request) {
|
||||
env := TestEnvironment{
|
||||
Params: params,
|
||||
Client: client,
|
||||
CreatedTeamId: teamID,
|
||||
CreatedUserId: userID,
|
||||
CreatedTeamID: teamID,
|
||||
CreatedUserID: userID,
|
||||
Context: c,
|
||||
Writer: w,
|
||||
Request: r,
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
const LINK_POST_TEXT = `
|
||||
const linkPostText = `
|
||||
Some Links:
|
||||
https://spinpunch.atlassian.net/issues/?filter=10101&jql=resolution%20in%20(Fixed%2C%20%22Won't%20Fix%22%2C%20Duplicate%2C%20%22Cannot%20Reproduce%22)%20AND%20Resolution%20%3D%20Fixed%20AND%20updated%20%3E%3D%20-7d%20ORDER%20BY%20updatedDate%20DESC
|
||||
|
||||
@@ -23,14 +23,14 @@ https://medium.com/@slackhq/11-useful-tips-for-getting-the-most-of-slack-5dfb3d1
|
||||
|
||||
func testAutoLink(env TestEnvironment) *model.AppError {
|
||||
mlog.Info("Manual Auto Link Test")
|
||||
channelID, err := getChannelID(env.Context.App, model.DEFAULT_CHANNEL, env.CreatedTeamId, env.CreatedUserId)
|
||||
channelID, err := getChannelID(env.Context.App, model.DEFAULT_CHANNEL, env.CreatedTeamID, env.CreatedUserID)
|
||||
if !err {
|
||||
return model.NewAppError("/manualtest", "manaultesting.test_autolink.unable.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
post := &model.Post{
|
||||
ChannelId: channelID,
|
||||
Message: LINK_POST_TEXT}
|
||||
Message: linkPostText}
|
||||
_, resp := env.Client.CreatePost(post)
|
||||
return resp.Error
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user