update unit tests for default channels

This commit is contained in:
JoramWilander
2015-06-29 11:14:12 -04:00
parent 72d54e427c
commit ba998db099
3 changed files with 26 additions and 3 deletions

View File

@@ -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 {

View File

@@ -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")
}

View File

@@ -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")
}