summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-01-06 18:10:00 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-01-06 12:10:00 -0500
commit61771a0fc53a9c50f096b0dcc422f12ce80baf20 (patch)
tree148bfc997976a536782ad8effd302ec6f1a4dbda /api
parentc96a36e9b33952efaed17f0f440c60b676464dbf (diff)
downloadchat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.tar.gz
chat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.tar.bz2
chat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.zip
inital draft (#4883)
Diffstat (limited to 'api')
-rw-r--r--api/post_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/api/post_test.go b/api/post_test.go
index 509432a25..e48debcae 100644
--- a/api/post_test.go
+++ b/api/post_test.go
@@ -1389,3 +1389,33 @@ func TestGetPostById(t *testing.T) {
t.Fatal(respMetadata.Error)
}
}
+
+func TestGetPermalinkTmp(t *testing.T) {
+ th := Setup().InitBasic()
+ Client := th.BasicClient
+ channel1 := th.BasicChannel
+
+ time.Sleep(10 * time.Millisecond)
+ post1 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
+ post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
+
+ time.Sleep(10 * time.Millisecond)
+ post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"}
+ post2 = Client.Must(Client.CreatePost(post2)).Data.(*model.Post)
+
+ etag := Client.Must(Client.GetPost(channel1.Id, post1.Id, "")).Etag
+
+ // test etag caching
+ if cache_result, respMetadata := Client.GetPermalink(channel1.Id, post1.Id, etag); respMetadata.Error != nil {
+ t.Fatal(respMetadata.Error)
+ } else if cache_result != nil {
+ t.Log(cache_result)
+ t.Fatal("cache should be empty")
+ }
+
+ if results, respMetadata := Client.GetPermalink(channel1.Id, post1.Id, ""); respMetadata.Error != nil {
+ t.Fatal(respMetadata.Error)
+ } else if results == nil {
+ t.Fatal("should not be empty")
+ }
+}