Add test for attachments
This commit is contained in:
parent
a5afe10f52
commit
3221602fdf
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user