[MM-19969] - When bulk import finds an already existing post, it should delete existing files (#13037)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2019-12-03 12:52:29 +03:00
коммит произвёл Ben Schumacher
родитель d0d6ce0a70
Коммит 4859208744
2 изменённых файлов: 85 добавлений и 60 удалений

Просмотреть файл

@@ -2569,6 +2569,7 @@ func TestImportPostAndRepliesWithAttachments(t *testing.T) {
}},
}
// import with attachments
err = th.App.ImportPost(data, false)
assert.Nil(t, err)
@@ -2578,6 +2579,16 @@ func TestImportPostAndRepliesWithAttachments(t *testing.T) {
assert.Contains(t, attachments[1].Path, team.Id)
AssertFileIdsInPost(attachments, th, t)
// import existing post with new attachments
data.Attachments = &[]AttachmentImportData{{Path: &testImage}}
err = th.App.ImportPost(data, false)
assert.Nil(t, err)
attachments = GetAttachments(user3.Id, th, t)
assert.Equal(t, len(attachments), 1)
assert.Contains(t, attachments[0].Path, team.Id)
AssertFileIdsInPost(attachments, th, t)
attachments = GetAttachments(user4.Id, th, t)
assert.Equal(t, len(attachments), 1)
assert.Contains(t, attachments[0].Path, team.Id)