summaryrefslogtreecommitdiffstats
path: root/app/import_functions_test.go
diff options
context:
space:
mode:
authorcpanato <ctadeu@gmail.com>2018-08-08 13:53:10 +0200
committercpanato <ctadeu@gmail.com>2018-08-08 13:53:10 +0200
commitae891321ad2e4b07e4f77b252379cb998607c687 (patch)
treede7cfa9b9fb1c0d7da2164e42e8516f62c7aaff1 /app/import_functions_test.go
parent99cf15b56eb561dc30def86ad7e3cd97af4c338c (diff)
parent5fbec91c35d7ea5d9b920b26a01fc21da55bb08e (diff)
downloadchat-ae891321ad2e4b07e4f77b252379cb998607c687.tar.gz
chat-ae891321ad2e4b07e4f77b252379cb998607c687.tar.bz2
chat-ae891321ad2e4b07e4f77b252379cb998607c687.zip
Merge remote-tracking branch 'upstream/release-5.2' into release-5.2-daily-merge-20180808
Diffstat (limited to 'app/import_functions_test.go')
-rw-r--r--app/import_functions_test.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/import_functions_test.go b/app/import_functions_test.go
index e0859af45..fd8ae462e 100644
--- a/app/import_functions_test.go
+++ b/app/import_functions_test.go
@@ -1700,6 +1700,60 @@ func TestImportImportPost(t *testing.T) {
}
}
}
+
+ // Update post with replies.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 8, team.Id)
+
+ // Create new post with replies based on the previous one.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply 2"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 10, team.Id)
+
+ // Create new reply for existing post with replies.
+ data = &PostImportData{
+ Team: &teamName,
+ Channel: &channelName,
+ User: &user2.Username,
+ Message: ptrStr("Message with reply"),
+ CreateAt: &replyPostTime,
+ Replies: &[]ReplyImportData{{
+ User: &username,
+ Message: ptrStr("Message reply 2"),
+ CreateAt: &replyTime,
+ }},
+ }
+ if err := th.App.ImportPost(data, false); err != nil {
+ t.Fatalf("Expected success.")
+ }
+ AssertAllPostsCount(t, th.App, initialPostCount, 11, team.Id)
}
func TestImportImportDirectChannel(t *testing.T) {