mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
update unit tests for default channels
This commit is contained in:
@@ -35,8 +35,15 @@ func TestCreateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
rget := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
|
||||
if rget.Channels[0].Name != channel.Name {
|
||||
t.Fatal("full name didn't match")
|
||||
nameMatch := false
|
||||
for _, c := range rget.Channels {
|
||||
if c.Name == channel.Name {
|
||||
nameMatch = true
|
||||
}
|
||||
}
|
||||
|
||||
if !nameMatch {
|
||||
t.Fatal("Did not create channel with correct name")
|
||||
}
|
||||
|
||||
if _, err := Client.CreateChannel(rchannel.Data.(*model.Channel)); err == nil {
|
||||
|
||||
@@ -129,7 +129,7 @@ func TestJoinCommands(t *testing.T) {
|
||||
|
||||
c1 := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
|
||||
|
||||
if len(c1.Channels) != 3 { // 3 because of town-square and direct
|
||||
if len(c1.Channels) != 4 { // 4 because of town-square, off-topic and direct
|
||||
t.Fatal("didn't join channel")
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@ func TestCreateFromSignupTeam(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
c1 := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
|
||||
if len(c1.Channels) != 2 {
|
||||
t.Fatal("default channels not created")
|
||||
}
|
||||
|
||||
ts.Data = "garbage"
|
||||
_, err = Client.CreateTeamFromSignup(&ts)
|
||||
if err == nil {
|
||||
@@ -71,6 +76,17 @@ func TestCreateTeam(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
user := &model.User{TeamId: rteam.Data.(*model.Team).Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
|
||||
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
|
||||
Srv.Store.User().VerifyEmail(user.Id)
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
|
||||
c1 := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
|
||||
if len(c1.Channels) != 2 {
|
||||
t.Fatal("default channels not created")
|
||||
}
|
||||
|
||||
if rteam.Data.(*model.Team).Name != team.Name {
|
||||
t.Fatal("full name didn't match")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user