Fixed tests
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2019-10-14 22:08:10 +02:00
parent 6120db5068
commit 10346bb72f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 4 additions and 1 deletions

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)