diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /models/issue_reaction_test.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
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
Diffstat (limited to 'models/issue_reaction_test.go')
-rw-r--r-- | models/issue_reaction_test.go | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/models/issue_reaction_test.go b/models/issue_reaction_test.go index c01e4add7a..458250ac58 100644 --- a/models/issue_reaction_test.go +++ b/models/issue_reaction_test.go @@ -8,12 +8,13 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/setting" "github.com/stretchr/testify/assert" ) -func addReaction(t *testing.T, doer *User, issue *Issue, comment *Comment, content string) { +func addReaction(t *testing.T, doer *user_model.User, issue *Issue, comment *Comment, content string) { var reaction *Reaction var err error if comment == nil { @@ -28,7 +29,7 @@ func addReaction(t *testing.T, doer *User, issue *Issue, comment *Comment, conte func TestIssueAddReaction(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) @@ -40,7 +41,7 @@ func TestIssueAddReaction(t *testing.T) { func TestIssueAddDuplicateReaction(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) @@ -61,7 +62,7 @@ func TestIssueAddDuplicateReaction(t *testing.T) { func TestIssueDeleteReaction(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) @@ -78,11 +79,11 @@ func TestIssueReactionCount(t *testing.T) { setting.UI.ReactionMaxUserNum = 2 - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) - user2 := unittest.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) - user3 := unittest.AssertExistsAndLoadBean(t, &User{ID: 3}).(*User) - user4 := unittest.AssertExistsAndLoadBean(t, &User{ID: 4}).(*User) - ghost := NewGhostUser() + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) + user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) + user3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}).(*user_model.User) + user4 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}).(*user_model.User) + ghost := user_model.NewGhostUser() issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue) @@ -114,7 +115,7 @@ func TestIssueReactionCount(t *testing.T) { func TestIssueCommentAddReaction(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) @@ -128,10 +129,10 @@ func TestIssueCommentAddReaction(t *testing.T) { func TestIssueCommentDeleteReaction(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) - user2 := unittest.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) - user3 := unittest.AssertExistsAndLoadBean(t, &User{ID: 3}).(*User) - user4 := unittest.AssertExistsAndLoadBean(t, &User{ID: 4}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) + user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) + user3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}).(*user_model.User) + user4 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) repo1 := unittest.AssertExistsAndLoadBean(t, &Repository{ID: issue1.RepoID}).(*Repository) @@ -155,7 +156,7 @@ func TestIssueCommentDeleteReaction(t *testing.T) { func TestIssueCommentReactionCount(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - user1 := unittest.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User) + user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) issue1 := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) |