From 3221602fdf56c21bec78316e9cfab5ebf4a3a24e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 16 Dec 2020 23:34:50 +0100 Subject: [PATCH] Add test for attachments --- pkg/modules/migration/trello/trello_test.go | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkg/modules/migration/trello/trello_test.go b/pkg/modules/migration/trello/trello_test.go index 5c717d018..23b3e19b8 100644 --- a/pkg/modules/migration/trello/trello_test.go +++ b/pkg/modules/migration/trello/trello_test.go @@ -17,18 +17,25 @@ package trello import ( + "code.vikunja.io/api/pkg/config" + "code.vikunja.io/api/pkg/files" "code.vikunja.io/api/pkg/models" "github.com/adlio/trello" "github.com/d4l3k/messagediff" "github.com/stretchr/testify/assert" + "io/ioutil" "testing" "time" ) func TestConvertTrelloToVikunja(t *testing.T) { + config.InitConfig() + time1, err := time.Parse(time.RFC3339Nano, "2014-09-26T08:25:05Z") assert.NoError(t, err) + exampleFile, err := ioutil.ReadFile(config.ServiceRootpath.GetString() + "/pkg/modules/migration/wunderlist/testimage.jpg") + assert.NoError(t, err) trelloData := []*trello.Board{ { @@ -56,6 +63,14 @@ func TestConvertTrelloToVikunja(t *testing.T) { Color: "orange", }, }, + Attachments: []*trello.Attachment{ + { + Name: "Testimage.jpg", + IsUpload: true, + MimeType: "image/jpg", + URL: "https://vikunja.io/testimage.jpg", + }, + }, }, { Name: "Test Card 2", @@ -178,6 +193,16 @@ func TestConvertTrelloToVikunja(t *testing.T) { HexColor: trelloColorMap["orange"], }, }, + Attachments: []*models.TaskAttachment{ + { + File: &files.File{ + Name: "Testimage.jpg", + Mime: "image/jpg", + Size: uint64(len(exampleFile)), + FileContent: exampleFile, + }, + }, + }, }, { Title: "Test Card 2",