update unit test
Этот коммит содержится в:
@@ -61,6 +61,7 @@ func createValetPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
if !utils.Cfg.TeamSettings.AllowValet {
|
if !utils.Cfg.TeamSettings.AllowValet {
|
||||||
c.Err = model.NewAppError("createValetPost", "The valet feature is currently turned off. Please contact your system administrator for details.", "")
|
c.Err = model.NewAppError("createValetPost", "The valet feature is currently turned off. Please contact your system administrator for details.", "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
post := model.PostFromJson(r.Body)
|
post := model.PostFromJson(r.Body)
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ func TestCreateValetPost(t *testing.T) {
|
|||||||
channel2 := &model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
channel2 := &model.Channel{DisplayName: "Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||||
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
|
||||||
|
|
||||||
|
if utils.Cfg.TeamSettings.AllowValet {
|
||||||
post1 := &model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a"}
|
post1 := &model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a"}
|
||||||
rpost1, err := Client.CreateValetPost(post1)
|
rpost1, err := Client.CreateValetPost(post1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -204,6 +205,14 @@ func TestCreateValetPost(t *testing.T) {
|
|||||||
if _, err = Client.DoPost("/channels/"+channel3.Id+"/create", "garbage"); err == nil {
|
if _, err = Client.DoPost("/channels/"+channel3.Id+"/create", "garbage"); err == nil {
|
||||||
t.Fatal("should have been an error")
|
t.Fatal("should have been an error")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
post1 := &model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a"}
|
||||||
|
_, err := Client.CreateValetPost(post1)
|
||||||
|
if err.StatusCode != http.StatusNotImplemented {
|
||||||
|
t.Fatal(err)
|
||||||
|
t.Fatal("Should have failed with 501 - Not Implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatePost(t *testing.T) {
|
func TestUpdatePost(t *testing.T) {
|
||||||
|
|||||||
@@ -157,10 +157,12 @@ func createTeamFromSignup(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if utils.Cfg.TeamSettings.AllowValet {
|
||||||
CreateValet(c, rteam)
|
CreateValet(c, rteam)
|
||||||
if c.Err != nil {
|
if c.Err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InviteMembers(rteam, ruser, teamSignup.Invites)
|
InviteMembers(rteam, ruser, teamSignup.Invites)
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user