mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
fix TestListCommands
This commit is contained in:
@@ -24,7 +24,10 @@ func TestListCommands(t *testing.T) {
|
||||
|
||||
Client.LoginByEmail(team.Name, user1.Email, "pwd")
|
||||
|
||||
if results, err := Client.ListCommands(); err != nil {
|
||||
channel1 := &model.Channel{DisplayName: "AA", Name: "aa" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
|
||||
|
||||
if results, err := Client.ListCommands(channel1.Id, "/test"); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
commands := results.Data.([]*model.Command)
|
||||
|
||||
@@ -363,8 +363,11 @@ func (c *Client) Command(channelId string, command string, suggest bool) (*Resul
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) ListCommands() (*Result, *AppError) {
|
||||
if r, err := c.DoApiGet("/commands/list", "", ""); err != nil {
|
||||
func (c *Client) ListCommands(channelId string, command string) (*Result, *AppError) {
|
||||
m := make(map[string]string)
|
||||
m["command"] = command
|
||||
m["channelId"] = channelId
|
||||
if r, err := c.DoApiPost("/commands/list", MapToJson(m)); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||
|
||||
Reference in New Issue
Block a user