diff options
Diffstat (limited to 'api4/system_test.go')
-rw-r--r-- | api4/system_test.go | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/api4/system_test.go b/api4/system_test.go index 658bb5881..289a41907 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -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") } |