diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-09-15 15:59:29 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-15 15:59:29 -0400 |
commit | 1bbb5265be24476faa2d44f8538918708391bde8 (patch) | |
tree | 5f1b30ec8a4cf1dfa1366b7945accb502add43ba /api/admin_test.go | |
parent | bbb0607e1ddf3e3d530095ba2aa28abd9c49a3e4 (diff) | |
parent | 23a1311ef5f9ecac0a250419a49e74b290e63516 (diff) | |
download | chat-1bbb5265be24476faa2d44f8538918708391bde8.tar.gz chat-1bbb5265be24476faa2d44f8538918708391bde8.tar.bz2 chat-1bbb5265be24476faa2d44f8538918708391bde8.zip |
Merge pull request #681 from mattermost/PLT-12-log
PLT-12 Adding server logs viewer to admin console
Diffstat (limited to 'api/admin_test.go')
-rw-r--r-- | api/admin_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go new file mode 100644 index 000000000..460ac1208 --- /dev/null +++ b/api/admin_test.go @@ -0,0 +1,35 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +package api + +import ( + "testing" + + "github.com/mattermost/platform/model" + "github.com/mattermost/platform/store" +) + +func TestGetLogs(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)) + + 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 logs, err := Client.GetLogs(); err != nil { + t.Fatal(err) + } else if len(logs.Data.([]string)) <= 0 { + t.Fatal() + } +} |