PLT-2525: Render attachment fields similar to Slack
* Render attachment fields similar to Slack * Add /loadtest json url command This allows us to easily create test posts with more props like Slack attachments
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
1954c44993
Коммит
1a1fd39cf8
@@ -221,3 +221,44 @@ func TestLoadTestUrlCommands(t *testing.T) {
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
func TestLoadTestJsonCommands(t *testing.T) {
|
||||
Setup()
|
||||
// enable testing to use /loadtest but don't save it since we don't want to overwrite config.json
|
||||
enableTesting := utils.Cfg.ServiceSettings.EnableTesting
|
||||
defer func() {
|
||||
utils.Cfg.ServiceSettings.EnableTesting = enableTesting
|
||||
}()
|
||||
|
||||
utils.Cfg.ServiceSettings.EnableTesting = true
|
||||
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
|
||||
|
||||
Client.LoginByEmail(team.Name, user1.Email, "pwd")
|
||||
|
||||
channel := &model.Channel{DisplayName: "00", Name: "00" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel = Client.Must(Client.CreateChannel(channel)).Data.(*model.Channel)
|
||||
|
||||
command := "/loadtest json "
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Command must contain a url" {
|
||||
t.Fatal("/loadtest url with no url should've failed")
|
||||
}
|
||||
|
||||
command = "/loadtest json http://missingfiletonwhere/path/asdf/qwerty"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Unable to get file" {
|
||||
t.Log(r.Text)
|
||||
t.Fatal("/loadtest url with invalid url should've failed")
|
||||
}
|
||||
|
||||
command = "/loadtest url https://secure.beldienst.nl/test.json" // Chicken-egg so will replace with mattermost/platform URL soon
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for README.md should've executed")
|
||||
}
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user