Task Attachments #104
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue