summaryrefslogtreecommitdiffstats
path: root/app/import_functions_test.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-08-08 12:10:05 +0200
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-08 12:10:05 +0200
commit5fbec91c35d7ea5d9b920b26a01fc21da55bb08e (patch)
tree533f7dfb17e151cd5fc76d3ed8c30d19b8475723 /app/import_functions_test.go
parent7475cd260a3aba46e0b7524656b42209c1779c22 (diff)
downloadchat-5fbec91c35d7ea5d9b920b26a01fc21da55bb08e.tar.gz
chat-5fbec91c35d7ea5d9b920b26a01fc21da55bb08e.tar.bz2
chat-5fbec91c35d7ea5d9b920b26a01fc21da55bb08e.zip
MM-9747: Small fixes for attachments import (#9225)
* MM-9747: Small fixes for attachments import * Adding unit test RootId check in replies
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) {