mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Implement GET /audits endpoint for APIv4 (#5779)
* Implement GET /audits endpoint for APIv4 * Fix log unit test
This commit is contained in:
@@ -127,7 +127,43 @@ func TestUpdateConfig(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAudits(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
|
||||
audits, resp := th.SystemAdminClient.GetAudits(0, 100, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(audits) == 0 {
|
||||
t.Fatal("should not be empty")
|
||||
}
|
||||
|
||||
audits, resp = th.SystemAdminClient.GetAudits(0, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(audits) != 1 {
|
||||
t.Fatal("should only be 1")
|
||||
}
|
||||
|
||||
audits, resp = th.SystemAdminClient.GetAudits(1, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(audits) != 1 {
|
||||
t.Fatal("should only be 1")
|
||||
}
|
||||
|
||||
_, resp = th.SystemAdminClient.GetAudits(-1, -1, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
_, resp = Client.GetAudits(0, 100, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.GetAudits(0, 100, "")
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestEmailTest(t *testing.T) {
|
||||
@@ -217,7 +253,7 @@ func TestGetLogs(t *testing.T) {
|
||||
logs, resp = th.SystemAdminClient.GetLogs(-1, -1)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(logs) != 0 {
|
||||
if len(logs) == 0 {
|
||||
t.Fatal("should not be empty")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user