summaryrefslogtreecommitdiffstats
path: root/api/admin_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-03 08:52:18 -0500
committerChristopher Speller <crspeller@gmail.com>2016-02-03 08:52:18 -0500
commit75f412c4be81abfd99e2aed8c24dd15db9ae1068 (patch)
tree7e1aeb0ced8e02b8d6bed5bdce841d3f5b99f45e /api/admin_test.go
parentd479b08c997d3216938a3e92c3634a8b5afdb841 (diff)
parentd153d661db7d4349d69824d318aa9ad571970606 (diff)
downloadchat-75f412c4be81abfd99e2aed8c24dd15db9ae1068.tar.gz
chat-75f412c4be81abfd99e2aed8c24dd15db9ae1068.tar.bz2
chat-75f412c4be81abfd99e2aed8c24dd15db9ae1068.zip
Merge pull request #2049 from mattermost/plt-1856
PLT-1856 Add basic server audit tab to system console for EE
Diffstat (limited to 'api/admin_test.go')
-rw-r--r--api/admin_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index 053a2a730..8a9c82b44 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -41,6 +41,36 @@ func TestGetLogs(t *testing.T) {
}
}
+func TestGetAllAudits(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() + "success+test@simulator.amazonses.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.GetAllAudits(); 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 audits, err := Client.GetAllAudits(); err != nil {
+ t.Fatal(err)
+ } else if len(audits.Data.(model.Audits)) <= 0 {
+ t.Fatal()
+ }
+}
+
func TestGetClientProperties(t *testing.T) {
Setup()