Task Attachments #104

Merged
konrad merged 63 commits from feature/attachments into master 2019-10-16 20:52:31 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 10346bb72f - Show all commits

View File

@ -57,6 +57,7 @@ func (ta *TaskAttachment) NewAttachment(f io.ReadCloser, realname string, realsi
}
return err
}
ta.File = file
// Add an entry to the db
ta.FileID = file.ID

View File

@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"io"
"os"
"strconv"
"testing"
)
@ -98,7 +99,8 @@ func TestTaskAttachment_NewAttachment(t *testing.T) {
err := ta.NewAttachment(tf, "testfile", 100, testuser)
assert.NoError(t, err)
_, err = files.FileStat("files/2")
assert.NotEqual(t, 0, ta.FileID)
_, err = files.FileStat("files/" + strconv.FormatInt(ta.FileID, 10))
assert.NoError(t, err)
assert.False(t, os.IsNotExist(err))
assert.Equal(t, testuser.ID, ta.CreatedByID)