forked from forgejo/forgejo
Move user related model into models/user (#17781)
* Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
This commit is contained in:
parent
4e7ca946da
commit
a666829a37
345 changed files with 4230 additions and 3813 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -18,7 +19,7 @@ func TestCreateComment(t *testing.T) {
|
|||
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &Issue{}).(*Issue)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: issue.RepoID}).(*Repository)
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
|
||||
|
||||
now := time.Now().Unix()
|
||||
comment, err := CreateComment(&CreateCommentOptions{
|
||||
|
@ -46,7 +47,7 @@ func TestFetchCodeComments(t *testing.T) {
|
|||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue)
|
||||
user := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User)
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User)
|
||||
res, err := FetchCodeComments(issue, user)
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, res, "README.md")
|
||||
|
@ -54,7 +55,7 @@ func TestFetchCodeComments(t *testing.T) {
|
|||
assert.Len(t, res["README.md"][4], 1)
|
||||
assert.Equal(t, int64(4), res["README.md"][4][0].ID)
|
||||
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
|
||||
res, err = FetchCodeComments(issue, user2)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, res, 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue