forked from forgejo/forgejo
Move attachment into models/repo/ (#17650)
* Move attachment into models/repo/ * Fix test * Fix bug
This commit is contained in:
parent
7a03473159
commit
fc3d082609
39 changed files with 477 additions and 414 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -29,14 +30,14 @@ func TestUploadAttachment(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
defer f.Close()
|
||||
|
||||
attach, err := NewAttachment(&models.Attachment{
|
||||
attach, err := NewAttachment(&repo_model.Attachment{
|
||||
RepoID: 1,
|
||||
UploaderID: user.ID,
|
||||
Name: filepath.Base(fPath),
|
||||
}, f)
|
||||
assert.NoError(t, err)
|
||||
|
||||
attachment, err := models.GetAttachmentByUUID(attach.UUID)
|
||||
attachment, err := repo_model.GetAttachmentByUUID(attach.UUID)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, user.ID, attachment.UploaderID)
|
||||
assert.Equal(t, int64(0), attachment.DownloadCount)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue