summaryrefslogtreecommitdiffstats
path: root/api/admin_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-21 15:11:56 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-21 15:11:56 -0700
commited9a2da83b3b77e7dd0314eaa92082ac8a2a9a9c (patch)
tree3c890327d884b33ad149196ddf9879313b2b000b /api/admin_test.go
parentee5a77ec56ee13f5eb96fce6065b4b7a1845de89 (diff)
downloadchat-ed9a2da83b3b77e7dd0314eaa92082ac8a2a9a9c.tar.gz
chat-ed9a2da83b3b77e7dd0314eaa92082ac8a2a9a9c.tar.bz2
chat-ed9a2da83b3b77e7dd0314eaa92082ac8a2a9a9c.zip
Adding email to admin console
Diffstat (limited to 'api/admin_test.go')
-rw-r--r--api/admin_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index e1778b5ac..c74fbf6e5 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -122,3 +122,31 @@ func TestSaveConfig(t *testing.T) {
}
}
}
+
+func TestEmailTest(t *testing.T) {
+ Setup()
+
+ team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
+ team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
+
+ user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
+ user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
+ store.Must(Srv.Store.User().VerifyEmail(user.Id))
+
+ Client.LoginByEmail(team.Name, user.Email, "pwd")
+
+ if _, err := Client.TestEmail(utils.Cfg); err == nil {
+ t.Fatal("Shouldn't have permissions")
+ }
+
+ c := &Context{}
+ c.RequestId = model.NewId()
+ c.IpAddress = "cmd_line"
+ UpdateRoles(c, user, model.ROLE_SYSTEM_ADMIN)
+
+ Client.LoginByEmail(team.Name, user.Email, "pwd")
+
+ if _, err := Client.TestEmail(utils.Cfg); err != nil {
+ t.Fatal(err)
+ }
+}