summaryrefslogtreecommitdiffstats
path: root/api4/system_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/system_test.go')
-rw-r--r--api4/system_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/api4/system_test.go b/api4/system_test.go
index 57cc10343..435501e72 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -392,3 +392,45 @@ func TestRemoveLicenseFile(t *testing.T) {
t.Fatal("should pass")
}
}
+
+func TestGetAnalyticsOld(t *testing.T) {
+ th := Setup().InitBasic().InitSystemAdmin()
+ defer TearDown()
+ Client := th.Client
+
+ rows, resp := Client.GetAnalyticsOld("", "")
+ CheckForbiddenStatus(t, resp)
+ if rows != nil {
+ t.Fatal("should be nil")
+ }
+
+ rows, resp = th.SystemAdminClient.GetAnalyticsOld("", "")
+ CheckNoError(t, resp)
+
+ found := false
+ for _, row := range rows {
+ if row.Name == "unique_user_count" {
+ found = true
+ }
+ }
+
+ if !found {
+ t.Fatal("should return unique user count")
+ }
+
+ _, resp = th.SystemAdminClient.GetAnalyticsOld("post_counts_day", "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.GetAnalyticsOld("user_counts_with_posts_day", "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.GetAnalyticsOld("extra_counts", "")
+ CheckNoError(t, resp)
+
+ _, resp = th.SystemAdminClient.GetAnalyticsOld("", th.BasicTeam.Id)
+ CheckNoError(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetAnalyticsOld("", th.BasicTeam.Id)
+ CheckUnauthorizedStatus(t, resp)
+}