summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-29 11:14:12 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-29 11:14:12 -0400
commitba998db0998e7782842e4f86a242edd1e52b5e97 (patch)
tree88b4e052c68d4434819aac798bd6822417ea1dc2
parent72d54e427c035162260f47b0b79864e6193861e9 (diff)
downloadchat-ba998db0998e7782842e4f86a242edd1e52b5e97.tar.gz
chat-ba998db0998e7782842e4f86a242edd1e52b5e97.tar.bz2
chat-ba998db0998e7782842e4f86a242edd1e52b5e97.zip
update unit tests for default channels
-rw-r--r--api/channel_test.go11
-rw-r--r--api/command_test.go2
-rw-r--r--api/team_test.go16
3 files changed, 26 insertions, 3 deletions
diff --git a/api/channel_test.go b/api/channel_test.go
index 2e2e3683a..dfae840dc 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -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 {
diff --git a/api/command_test.go b/api/command_test.go
index d3b0da455..5b7734628 100644
--- a/api/command_test.go
+++ b/api/command_test.go
@@ -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")
}
diff --git a/api/team_test.go b/api/team_test.go
index 042c0a2e9..bb77d43a0 100644
--- a/api/team_test.go
+++ b/api/team_test.go
@@ -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")
}