summaryrefslogtreecommitdiffstats
path: root/api/admin_test.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-11-30 08:51:36 -0800
committerCorey Hulen <corey@hulen.com>2015-11-30 08:51:36 -0800
commit93f08717a8cf40b1e3be138ed9d5b4d76fcfadb9 (patch)
tree4b81b2c63329364cb391427b61a1ab7f2bd5969f /api/admin_test.go
parentce259ad7f1ce8a52b7fc5af7542a101acf71173e (diff)
parent7ac97273855e5e68d9e4b10e96d5466201fb8871 (diff)
downloadchat-93f08717a8cf40b1e3be138ed9d5b4d76fcfadb9.tar.gz
chat-93f08717a8cf40b1e3be138ed9d5b4d76fcfadb9.tar.bz2
chat-93f08717a8cf40b1e3be138ed9d5b4d76fcfadb9.zip
Merge pull request #1537 from florianorben/PLT-1035
PLT-1035: Remove last data point in graphs on #statistics page
Diffstat (limited to 'api/admin_test.go')
-rw-r--r--api/admin_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/api/admin_test.go b/api/admin_test.go
index 0db5caa4c..0a1682a99 100644
--- a/api/admin_test.go
+++ b/api/admin_test.go
@@ -235,6 +235,10 @@ func TestGetPostCount(t *testing.T) {
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
+ // manually update creation time, since it's always set to 0 upon saving and we only retrieve posts < today
+ Srv.Store.(*store.SqlStore).GetMaster().Exec("UPDATE Posts SET CreateAt = :CreateAt WHERE ChannelId = :ChannelId",
+ map[string]interface{}{"ChannelId": channel1.Id, "CreateAt": utils.MillisFromTime(utils.Yesterday())})
+
if _, err := Client.GetAnalytics(team.Id, "post_counts_day"); err == nil {
t.Fatal("Shouldn't have permissions")
}
@@ -276,6 +280,10 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
+ // manually update creation time, since it's always set to 0 upon saving and we only retrieve posts < today
+ Srv.Store.(*store.SqlStore).GetMaster().Exec("UPDATE Posts SET CreateAt = :CreateAt WHERE ChannelId = :ChannelId",
+ map[string]interface{}{"ChannelId": channel1.Id, "CreateAt": utils.MillisFromTime(utils.Yesterday())})
+
if _, err := Client.GetAnalytics(team.Id, "user_counts_with_posts_day"); err == nil {
t.Fatal("Shouldn't have permissions")
}